Commit 070bf642 authored by Jan Möbius's avatar Jan Möbius

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4033 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6876a6f3
......@@ -90,58 +90,6 @@ void set_sceneGraphRootNode( SeparatorNode* _root_node ) {
PluginFunctions::sceneGraph_root_node_ = _root_node;
}
bool get_source_meshes( std::vector<TriMesh*>& _meshes ) {
_meshes.clear();
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_TRIANGLE_MESH) ; o_it != PluginFunctions::objects_end(); ++o_it) {
if (! o_it->source() )
continue;
_meshes.push_back ( dynamic_cast< TriMeshObject* >( *o_it )->mesh() );
}
return (_meshes.size() > 0 );
}
bool get_source_meshes( std::vector<PolyMesh*>& _meshes ) {
_meshes.clear();
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_POLY_MESH) ; o_it != PluginFunctions::objects_end(); ++o_it) {
if (! o_it->source() )
continue;
_meshes.push_back ( dynamic_cast< PolyMeshObject* >( *o_it )->mesh() );
}
return (_meshes.size() > 0 );
}
bool get_target_meshes( std::vector<TriMesh*>& _meshes ) {
_meshes.clear();
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_TRIANGLE_MESH) ; o_it != PluginFunctions::objects_end(); ++o_it) {
if (! o_it->target() )
continue;
if ( dynamic_cast< TriMeshObject* >( *o_it )->mesh() )
_meshes.push_back ( dynamic_cast< TriMeshObject* >( *o_it )->mesh() );
}
return (_meshes.size() > 0 );
}
bool get_target_meshes( std::vector<PolyMesh*>& _meshes ) {
_meshes.clear();
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_POLY_MESH) ; o_it != PluginFunctions::objects_end(); ++o_it) {
if (! o_it->target() )
continue;
if ( dynamic_cast< PolyMeshObject* >( *o_it )->mesh() )
_meshes.push_back ( dynamic_cast< PolyMeshObject* >( *o_it )->mesh() );
}
return (_meshes.size() > 0 );
}
bool get_picked_object(uint _node_idx , BaseObjectData*& _object) {
for ( ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objects_end(); ++o_it) {
if ( o_it->picked( _node_idx ) ) {
......@@ -196,72 +144,10 @@ bool get_object( int _identifier , BaseObjectData*& _object ) {
return ( _object != 0 );
}
bool get_object( int _identifier , TriMeshObject*& _object ) {
if ( _identifier == -1 )
return false;
BaseObject* object = objectRoot_->childExists( _identifier );
_object = dynamic_cast< TriMeshObject* >(object);
return ( _object != 0 );
}
bool get_object( int _identifier , PolyMeshObject*& _object ) {
if ( _identifier == -1 )
return false;
BaseObject* object = objectRoot_->childExists( _identifier );
_object = dynamic_cast< PolyMeshObject* >(object);
return ( _object != 0 );
}
// ===============================================================================
// ===============================================================================
bool get_mesh( int _identifier , TriMesh*& _mesh ) {
if ( _identifier == -1 )
return false;
BaseObject* object = objectRoot_->childExists( _identifier );
// Unable to find object
if ( object == 0)
return false;
TriMeshObject* triangleMeshObject = dynamic_cast< TriMeshObject* > (object);
// Object is not a triangle mesh
if ( triangleMeshObject == 0)
return false;
_mesh = triangleMeshObject->mesh();
return true;
}
bool get_mesh( int _identifier , PolyMesh*& _mesh ) {
if ( _identifier == -1 )
return false;
BaseObject* object = objectRoot_->childExists( _identifier );
// Unable to find object
if ( object == 0)
return false;
PolyMeshObject* polyMeshObject = dynamic_cast< PolyMeshObject* > (object);
// Object is not a triangle mesh
if ( polyMeshObject == 0)
return false;
_mesh = polyMeshObject->mesh();
return true;
}
bool deleteObject( int _id ) {
if ( _id == -1 )
......@@ -618,8 +504,8 @@ void get_all_objects( std::vector < BaseObjectData*>& _objects ) {
}
/// Fly to point and viewing direction (animated).
void flyTo (const TriMesh::Point &_position, const TriMesh::Point &_center, double _time) {
examiner_widget_->flyTo((ACG::Vec3d)_position,(ACG::Vec3d)_center,_time);
void flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time) {
examiner_widget_->flyTo(_position,_center,_time);
}
......@@ -634,48 +520,6 @@ BaseObjectData* baseObjectData( BaseObject* _object ){
return dynamic_cast< BaseObjectData* >(_object);
}
TriMesh* triMesh( BaseObjectData* _object ) {
if ( _object == 0 )
return 0;
if ( _object->dataType(DATA_TRIANGLE_MESH) ) {
TriMeshObject* object = dynamic_cast< TriMeshObject* >(_object);
return object->mesh();
} else
return NULL;
}
PolyMesh* polyMesh( BaseObjectData* _object ) {
if ( _object == 0 )
return 0;
if ( _object->dataType(DATA_POLY_MESH) ) {
PolyMeshObject* object = dynamic_cast< PolyMeshObject* >(_object);
return object->mesh();
} else
return NULL;
}
TriMeshObject* triMeshObject( BaseObjectData* _object ) {
if ( _object == 0 )
return 0;
if ( ! _object->dataType(DATA_TRIANGLE_MESH) )
return NULL;
return dynamic_cast< TriMeshObject* >( _object );
}
PolyMeshObject* polyMeshObject( BaseObjectData* _object ) {
if ( _object == 0 )
return 0;
if ( ! _object->dataType(DATA_POLY_MESH) )
return NULL;
return dynamic_cast< PolyMeshObject* >( _object );
}
// ===============================================================================
// Get the root of the object structure
// ===============================================================================
......
......@@ -49,17 +49,11 @@
#include <OpenFlipper/common/Types.hh>
// #include <ACG/Math/VectorT.hh>
#include <ACG/QtWidgets/QtExaminerViewer.hh>
#include <ACG/QtWidgets/QtBaseViewer.hh>
#include <ACG/GL/GLState.hh>
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
#include "PluginFunctionsBSplineSurface.hh"
#endif
#include "PluginFunctionsPolyMesh.hh"
/** The Namespace PluginFunctions contains functions for all plugins. These functions should be used to get the
* objects to work on or to set modes in the examiner widget. */
namespace PluginFunctions {
......@@ -70,38 +64,6 @@ namespace PluginFunctions {
* @{ */
//=======================================
/** \brief Get a pointer to every Triangle Mesh which is marked as a source mesh.
*
* @param _meshes ( vector returning the source meshes )
* @return false, if no mesh is selected as source
*/
DLLEXPORT
bool get_source_meshes( std::vector<TriMesh*>& _meshes );
/** \brief Get a pointer to every Poly Mesh which is marked as a source mesh.
*
* @param _meshes ( vector returning the source meshes )
* @return false, if no mesh is selected as source
*/
DLLEXPORT
bool get_source_meshes( std::vector<PolyMesh*>& _meshes );
/** \brief Get a pointer to every Triangle Mesh which is marked as a target mesh.
*
* @param _meshes ( vector returning the target meshes )
* @return false, if no mesh is selected as target
*/
DLLEXPORT
bool get_target_meshes( std::vector<TriMesh*>& _meshes );
/** \brief Get a pointer to every Poly Mesh which is marked as a target mesh.
*
* @param _meshes ( vector returning the target meshes )
* @return false, if no mesh is selected as target
*/
DLLEXPORT
bool get_target_meshes( std::vector<PolyMesh*>& _meshes );
/** \brief Get the picked mesh
* @param _node_idx Node index returned by examiner picking
* @param _object returns the object which contains the mesh
......@@ -197,46 +159,6 @@ bool get_object( int _identifier , BaseObject*& _object );
DLLEXPORT
bool get_object( int _identifier , BaseObjectData*& _object );
/** This functions returns the object with the given id if it is a TriMeshObject.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
*/
DLLEXPORT
bool get_object( int _identifier , TriMeshObject*& _object );
/** This functions returns the object with the given id if it is a PolyMeshObject.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
*/
DLLEXPORT
bool get_object( int _identifier , PolyMeshObject*& _object );
/** \brief Get the Triangle Mesh which has the given identifier.
*
* Every loaded object has a unique identifier which is stored in the id field of the object container.
* Use this function to get the mesh which has this id. This can be used for a consistent mapping
* even if the data objects change during plugin operations (e.g. selection and main algorithm).\n
* This function checks, if the object requested contains a mesh.
* @param _identifier Object id to search for
* @param _mesh returns the mesh
* @return Mesh found?
*/
DLLEXPORT
bool get_mesh( int _identifier , TriMesh*& _mesh );
/** \brief Get the Poly Mesh which has the given identifier.
*
* Every loaded object has a unique identifier which is stored in the id field of the object container.
* Use this function to get the mesh which has this id. This can be used for a consistent mapping
* even if the data objects change during plugin operations (e.g. selection and main algorithm).\n
* This function checks, if the object requested contains a mesh.
* @param _identifier Object id to search for
* @param _mesh returns the mesh
* @return Mesh found?
*/
DLLEXPORT
bool get_mesh( int _identifier , PolyMesh*& _mesh );
/** \brief Check if an object with this identifier exists.
*
* Searches through the Data containers and checks if the object with the given identifier exists
......@@ -502,7 +424,7 @@ void mapToLocal( OpenMesh::Vec4f _color);
* @param _time Animation time in ms
*/
DLLEXPORT
void flyTo (const TriMesh::Point &_position, const TriMesh::Point &_center, double _time=1000.0);
void flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time=1000.0);
/** @} */
......@@ -618,38 +540,6 @@ void setDataRoot( BaseObject* _root );
* @{ */
//=======================================
/** \brief Get a triangle mesh from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a triangle Mesh, a
* triangle mesh will be returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
TriMesh* triMesh( BaseObjectData* _object );
/** \brief Get a poly mesh from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a poly Mesh, a
* poly mesh will be returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyMesh* polyMesh( BaseObjectData* _object );
/** \brief Cast an BaseObject to a TriMeshObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a triangle Mesh, a
* a TriMeshObject is returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
TriMeshObject* triMeshObject( BaseObjectData* _object );
/** \brief Cast an BaseObject to a PolyMeshObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a poly Mesh, a
* a PolyMeshObject is returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyMeshObject* polyMeshObject( BaseObjectData* _object );
/** \brief Cast an BaseObject to a BaseObjectData if possible
*
* @param _object The object should be of type BaseObject. If the content is a BaseObjectData, a
......@@ -666,13 +556,4 @@ BaseObject*& objectRoot();
}
/*
#if defined(INCLUDE_TEMPLATES) && !defined(PLUGINFUNCTIONS_C)
#define PLUGINFUNCTIONS_TEMPLATES
#include "PluginFunctionsT.cc"
#endif
*/
#endif //PLUGINFUNCTIONS_HH
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 4021 $
// $Author: moebius $
// $Date: 2008-12-18 13:57:59 +0100 (Do, 18. Dez 2008) $
//
//=============================================================================
//=============================================================================
//
// Standard Functions
//
//=============================================================================
/**
* \file PluginFunctions.hh
* This file contains functions which can be used by plugins to access data in the framework.
*/
//
#ifndef PLUGINFUNCTIONSPOLYMESH_HH
#define PLUGINFUNCTIONSPOLYMESH_HH
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
#include "PluginFunctionsBSplineSurface.hh"
#endif
/** The Namespace PluginFunctions contains functions for all plugins. These functions should be used to get the
* objects to work on or to set modes in the examiner widget. */
namespace PluginFunctions {
/** \brief Get a pointer to every Poly Mesh which is marked as a source mesh.
*
* @param _meshes ( vector returning the source meshes )
* @return false, if no mesh is selected as source
*/
DLLEXPORT
bool get_source_meshes( std::vector<PolyMesh*>& _meshes );
/** \brief Get a pointer to every Poly Mesh which is marked as a target mesh.
*
* @param _meshes ( vector returning the target meshes )
* @return false, if no mesh is selected as target
*/
DLLEXPORT
bool get_target_meshes( std::vector<PolyMesh*>& _meshes );
/** This functions returns the object with the given id if it is a PolyMeshObject.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
*/
DLLEXPORT
bool get_object( int _identifier , PolyMeshObject*& _object );
/** \brief Get the Poly Mesh which has the given identifier.
*
* Every loaded object has a unique identifier which is stored in the id field of the object container.
* Use this function to get the mesh which has this id. This can be used for a consistent mapping
* even if the data objects change during plugin operations (e.g. selection and main algorithm).\n
* This function checks, if the object requested contains a mesh.
* @param _identifier Object id to search for
* @param _mesh returns the mesh
* @return Mesh found?
*/
DLLEXPORT
bool get_mesh( int _identifier , PolyMesh*& _mesh );
//=======================================
/** @name Getting data from objects and casting between them
* @{ */
//=======================================
/** \brief Get a poly mesh from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a poly Mesh, a
* poly mesh will be returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyMesh* polyMesh( BaseObjectData* _object );
/** \brief Cast an BaseObject to a PolyMeshObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a poly Mesh, a
* a PolyMeshObject is returned. Otherwise a NULL pointer is returned.
*/
DLLEXPORT
PolyMeshObject* polyMeshObject( BaseObjectData* _object );
/** @} */
}
#endif //PLUGINFUNCTIONSPOLYMESH_HH
......@@ -127,7 +127,7 @@ static bool hideToolbox_ = false;
static bool hideLogger_ = false;
/// Store if we should go into multiview Mode
static bool multiView_ = false;
static bool multiView_ = true;
/// Start in Fullscreen Mode?
static bool fullScreen_ = false;
......
This diff is collapsed.
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision$
// $Author$
// $Date$
//
//=============================================================================
//=============================================================================
//
// Types
//
//=============================================================================
/**
* \file Types.hh
* This File contains the basic available datatypes in the Framework.
*/
#ifndef MESHOBJECT_HH
#define MESHOBJECT_HH
#ifndef DLLEXPORT
#ifdef WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
#endif
//== INCLUDES =================================================================
// -------------------- OpenMesh
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <ACG/Scenegraph/SeparatorNode.hh>
#include <ACG/Scenegraph/TextureNode.hh>
#include <ACG/Scenegraph/ShaderNode.hh>
#include <ACG/Scenegraph/StatusNodesT.hh>
/// Additional Node status Bits for Mesh
enum StatusBits {
/// Modifyable area
AREA = OpenMesh::Attributes::UNUSED << 1,
/// Handle Area
HANDLEAREA = OpenMesh::Attributes::UNUSED << 2
};
#include "StatusNodeMods.hh"
#include "TriangleMeshTypes.hh"
#include "PolyMeshTypes.hh"
// -------------------- BSP
#include <OpenFlipper/common/bsp/TriangleBSPT.hh>
#include "BaseObjectData.hh"
//== TYPEDEFS =================================================================
/// Texture Node
typedef ACG::SceneGraph::TextureNode TextureNode;
//== CLASS DEFINITION =========================================================
/** This class provides the functionality for all kind of meshes for the framework
*/
template < class MeshT, DataType objectDataType >
class DLLEXPORT MeshObject : public BaseObjectData {
public:
/** \brief copy constructor
*
* Create a copy of this object
*/
MeshObject(const MeshObject& _object);
/// constructor
MeshObject(SeparatorNode* _rootNode);
/// destructor
virtual ~MeshObject();
/// Reset current object, including all related nodes.
virtual void cleanup();
protected:
/// Initialise current object, including all related nodes.
virtual void init( MeshT* _mesh = 0);
//===========================================================================
/** @name Name and Path handling
* @{ */
//===========================================================================
public:
/// Set the name of the Object
void setName( QString _name );
//===========================================================================
/** @name Content
* @{ */
//===========================================================================
public:
/// return a pointer to the mesh
MeshT* mesh();
/// Update the whole Object (Selection,Topology,...)
virtual void update();
/// Call this function to update the modeling regions
void updateSelection();
/// Call this function to update the modeling regions
void updateModelingRegions();
/// Update Geometry of all data structures
void updateGeometry();
/// Update Topology of all data structures
void updateTopology();
/** return a full copy of this object ( All scenegraph nodes will be created )
* but the object will not be a part of the object tree.
*/
BaseObject* copy();
private:
MeshT* mesh_;
/** @} */
//===========================================================================