Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
Type-PolyLine
Commits
7eaa838e
Commit
7eaa838e
authored
Dec 21, 2016
by
Jan Möbius
Browse files
Introduced type directories
parents
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
ObjectTypes/PolyLine/CMakeLists.txt
0 → 100644
View file @
7eaa838e
include
(
ACGCommon
)
include_directories
(
..
${
ACG_INCLUDE_DIR
}
${
OPENMESH_INCLUDE_DIRS
}
${
CMAKE_SOURCE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIR
}
${
GLUT_INCLUDE_DIR
}
)
link_directories
(
${
GLEW_LIBRARY_DIR
}
${
ADDITIONAL_PLUGINLIB_LINK_DIRS
}
)
#=======================================================
# General defines
#=======================================================
# generate dllexport macros on windows
if
(
WIN32
)
add_definitions
(
-DPLUGINLIBDLL
-DACGDLL
-DUSEACG
)
endif
()
#=======================================================
# Cleanup
#=======================================================
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# collect all header,source files
acg_append_files
(
headers
"*.hh"
.
)
acg_append_files
(
sources
"*.cc"
.
)
# Match our current directory name
string
(
REGEX MATCH
"[^/
\\
]*$"
TYPENAME
${
CMAKE_CURRENT_SOURCE_DIR
}
)
string
(
TOUPPER
${
TYPENAME
}
TYPENAME
)
include_directories
(
..
${
ACG_INCLUDE_DIR
}
${
OPENMESH_INCLUDE_DIRS
}
${
CMAKE_SOURCE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/../..
${
CMAKE_CURRENT_BINARY_DIR
}
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIR
}
${
GLUT_INCLUDE_DIR
}
)
acg_add_library
(
${
TYPENAME
}
SHARED
${
sources
}
${
headers
}
)
add_dependencies
(
${
TYPENAME
}
OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib
)
target_link_libraries
(
${
TYPENAME
}
${
OPENMESH_LIBRARIES
}
ACG
${
QT_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GLEW_LIBRARY
}
${
GLUT_LIBRARIES
}
)
ObjectTypes/PolyLine/PluginFunctionsPolyLine.cc
0 → 100644
View file @
7eaa838e
/* ========================================================================= *
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
/*===========================================================================*\
*
* $Revision$
* $Date$
*
\*===========================================================================*/
//=============================================================================
//
// Plugin Functions for PolyLines
//
//=============================================================================
#include
<OpenFlipper/common/Types.hh>
#include
"PolyLine.hh"
#include
<OpenFlipper/BasePlugin/PluginFunctions.hh>
namespace
PluginFunctions
{
// ===============================================================================
// Get source polylines
// ===============================================================================
bool
getSourcePolylines
(
std
::
vector
<
PolyLine
*>&
_polylines
)
{
_polylines
.
clear
();
for
(
ObjectIterator
o_it
(
PluginFunctions
::
SOURCE_OBJECTS
,
DATA_POLY_LINE
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
{
_polylines
.
push_back
(
PluginFunctions
::
polyLine
(
*
o_it
)
);
if
(
_polylines
.
back
()
==
0
)
std
::
cerr
<<
"ERROR: Polyine get_source_polylines fatal error
\n
"
;
}
return
(
!
_polylines
.
empty
()
);
}
// ===============================================================================
// Get target polylines
// ===============================================================================
bool
getTargetPolylines
(
std
::
vector
<
PolyLine
*>&
_polylines
)
{
_polylines
.
clear
();
for
(
ObjectIterator
o_it
(
PluginFunctions
::
TARGET_OBJECTS
,
DATA_POLY_LINE
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
{
_polylines
.
push_back
(
PluginFunctions
::
polyLine
(
*
o_it
)
);
if
(
_polylines
.
back
()
==
0
)
std
::
cerr
<<
"ERROR: Polyine getTargetPolylines fatal error
\n
"
;
}
return
(
!
_polylines
.
empty
()
);
}
// ===============================================================================
// Get objects
// ===============================================================================
bool
getObject
(
int
_identifier
,
PolyLineObject
*&
_object
)
{
if
(
_identifier
==
BaseObject
::
NOOBJECT
)
{
_object
=
0
;
return
false
;
}
// Get object by using the map accelerated plugin function
BaseObjectData
*
object
=
0
;
PluginFunctions
::
getObject
(
_identifier
,
object
);
_object
=
dynamic_cast
<
PolyLineObject
*
>
(
object
);
return
(
_object
!=
0
);
}
// ===============================================================================
// Getting data from objects and casting between them
// ===============================================================================
PolyLine
*
polyLine
(
BaseObjectData
*
_object
)
{
if
(
_object
->
dataType
(
DATA_POLY_LINE
)
)
{
PolyLineObject
*
object
=
dynamic_cast
<
PolyLineObject
*
>
(
_object
);
return
object
->
line
();
}
else
return
0
;
}
PolyLineObject
*
polyLineObject
(
BaseObjectData
*
_object
)
{
if
(
!
_object
->
dataType
(
DATA_POLY_LINE
)
)
return
0
;
return
dynamic_cast
<
PolyLineObject
*
>
(
_object
);
}
PolyLineObject
*
polyLineObject
(
int
_objectId
)
{
if
(
_objectId
==
BaseObject
::
NOOBJECT
)
return
0
;
// Get object by using the map accelerated plugin function
BaseObjectData
*
object
=
0
;
PluginFunctions
::
getObject
(
_objectId
,
object
);
if
(
object
==
0
)
return
0
;
PolyLineObject
*
meshObject
=
dynamic_cast
<
PolyLineObject
*
>
(
object
);
return
meshObject
;
}
}
ObjectTypes/PolyLine/PluginFunctionsPolyLine.hh
0 → 100644
View file @
7eaa838e
/* ========================================================================= *
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
/*===========================================================================*\
*
* $Revision$
* $Date$
*
\*===========================================================================*/
//=============================================================================
//
// Standard Functions
//
//=============================================================================
/**
* \file PluginFunctionsPolyLine.hh
* This file contains functions which can be used by plugins to access polylines in the framework.
*/
//
#ifndef PLUGINFUNCTIONSPOLYLINE_HH
#define PLUGINFUNCTIONSPOLYLINE_HH
#include
<OpenFlipper/common/Types.hh>
/** The Namespace PluginFunctions contains functions for all plugins. */
namespace
PluginFunctions
{
/** \brief Get a pointer to every Polyline which is marked as a source.
*
* @param _polylines ( vector returning the source polylines )
* @return false, if no polyline is selected as source
*/
DLLEXPORT
bool
getSourcePolylines
(
std
::
vector
<
PolyLine
*>&
_polylines
);
/** \brief Get a pointer to every Polyline which is marked as a target.
*
* @param _polylines ( vector returning the target polylines )
* @return false, if no polyline is selected as target
*/
DLLEXPORT
bool
getTargetPolylines
(
std
::
vector
<
PolyLine
*>&
_polylines
);
/** This functions returns the object with the given id if it is a PolyLineObject.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
*/
DLLEXPORT
bool
getObject
(
int
_identifier
,
PolyLineObject
*&
_object
);
/** \brief Get a poly Line from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a poly Line, a
* poly line will be returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyLine
*
polyLine
(
BaseObjectData
*
_object
);
/** \brief Cast an BaseObject to a PolyLineObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a polyLine, a
* a PolyLineObject is returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyLineObject
*
polyLineObject
(
BaseObjectData
*
_object
);
/** \brief Get an PolyLineObject from the given id If possible
*
* @param _objectId Id of the requested Object. If the content is a volume, a
* a PolyLineObject is returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyLineObject
*
polyLineObject
(
int
_objectId
);
}
#endif // PLUGINFUNCTIONSPOLYLINE_HH
ObjectTypes/PolyLine/PolyLine.hh
0 → 100644
View file @
7eaa838e
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// PolyMeshTypes
//
//=============================================================================
/**
* \file PolyLine.hh
* This File contains all required includes for using Poly Lines
*/
#ifndef POLYLINE_INCLUDE_HH
#define POLYLINE_INCLUDE_HH
//== INCLUDES =================================================================
/** \def DATA_POLY_LINE
* Use this macro to reference polygonal lines
*/
#define DATA_POLY_LINE typeId("PolyLine")
#include
<ObjectTypes/PolyLine/PolyLineT.hh>
#include
<ObjectTypes/PolyLine/PolyLineObject.hh>
#include
<ObjectTypes/PolyLine/PluginFunctionsPolyLine.hh>
#include
<ObjectTypes/PolyLine/PolyLineTypes.hh>
//=============================================================================
#endif // POLYLINE_INCLUDE_HH defined
//=============================================================================
ObjectTypes/PolyLine/PolyLineBezierSplineData.cc
0 → 100644
View file @
7eaa838e
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS PolyLineCircleData - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include
"PolyLineBezierSplineData.hh"
PolyLineBezierSplineData
::
PolyLineBezierSplineData
(
unsigned
int
_meshIndex
)
:
meshIndex_
(
_meshIndex
)
{
}
void
PolyLineBezierSplineData
::
addInterpolatePoint
(
ACG
::
Vec3d
_position
,
ACG
::
Vec3d
_normal
)
{
InterpolatePoint
p
;
p
.
position
=
_position
;
p
.
normal
=
_normal
;
points_
.
push_back
(
p
);
}
bool
PolyLineBezierSplineData
::
finishSpline
()
{
if
(
points_
.
size
()
<
2
)
return
false
;
handles_
.
clear
();
for
(
unsigned
int
i
=
0
;
i
+
1
<
points_
.
size
();
i
++
)
{
const
ACG
::
Vec3d
firstPoint
=
points_
[
i
].
position
,
sndPoint
=
points_
[
i
+
1
].
position
;
double
r
=
(
firstPoint
-
sndPoint
).
norm
()
/
4.0
;
const
ACG
::
Vec3d
dir
=
sndPoint
-
firstPoint
;
const
ACG
::
Vec3d
ort0
=
dir
%
points_
[
i
].
normal
,
ort1
=
dir
%
points_
[
i
+
1
].
normal
;
ACG
::
Vec3d
f0
=
ort0
%
points_
[
i
].
normal
,
f1
=
ort1
%
points_
[
i
+
1
].
normal
;
ACG
::
Vec3d
near
=
firstPoint
-
f0
.
normalize
()
*
r
,
far
=
sndPoint
+
f1
.
normalize
()
*
r
;
handles_
.
push_back
(
near
);
handles_
.
push_back
(
far
);
}
//handles will be degenerate up to now
for
(
unsigned
int
i
=
1
;
i
+
1
<
handles_
.
size
();
i
+=
2
)
{
const
ACG
::
Vec3d
dir
=
(
handles_
[
i
+
1
]
-
handles_
[
i
])
/
2.0
;
InterpolatePoint
&
p
=
getInterpolatePoint
(
i
);
handles_
[
i
+
1
]
=
p
.
position
+
dir
;
handles_
[
i
]
=
p
.
position
-
dir
;
}
return
true
;
}
PolyLineBezierSplineData
::
InterpolatePoint
&
PolyLineBezierSplineData
::
getInterpolatePoint
(
unsigned
int
_handleIndex
)
{
if
(
!
_handleIndex
)
return
points_
[
0
];
else
if
(
_handleIndex
==
handles_
.
size
())
return
points_
.
back
();
else
return
points_
[(
_handleIndex
-
1
)
/
2
+
1
];
}
ObjectTypes/PolyLine/PolyLineBezierSplineData.hh
0 → 100644
View file @
7eaa838e
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *