Commit fac2afdd authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

On behalf of Hannes Hergeth: Visualization (ans picking) of Vec2*.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18856 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b43eaff6
......@@ -180,6 +180,8 @@ private:
TypeInfoWrapper proptype_double;
TypeInfoWrapper proptype_Vec3d;
TypeInfoWrapper proptype_Vec3f;
TypeInfoWrapper proptype_Vec2d;
TypeInfoWrapper proptype_Vec2f;
#ifdef ENABLE_SKELETON_SUPPORT
TypeInfoWrapper proptype_SkinWeights;
#endif
......
......@@ -48,6 +48,7 @@
#include "OMPropertyVisualizerDouble.hh"
#include "OMPropertyVisualizerInteger.hh"
#include "OMPropertyVisualizerVector.hh"
#include "OMPropertyVisualizerVector2.hh"
#include "OMPropertyVisualizerVectorFieldDifference.hh"
#ifdef ENABLE_SKELETON_SUPPORT
......@@ -73,7 +74,9 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
proptype_uint(TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int")),
proptype_double(TypeInfoWrapper(typeid(OpenMesh::PropertyT<double>), "double")),
proptype_Vec3d(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d")),
proptype_Vec3f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f"))
proptype_Vec3f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f")),
proptype_Vec2d(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2d>), "Vec2d")),
proptype_Vec2f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2f>), "Vec2f"))
#ifdef ENABLE_SKELETON_SUPPORT
,proptype_SkinWeights(TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights"))
#endif
......@@ -540,6 +543,7 @@ template<typename MeshT>
void OMPropertyModel<MeshT>::addPropertyVisualizer(OpenMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter)
{
PropertyInfo propInfo = PropertyInfo(baseProp->name(), getSupportedTypeInfoWrapper(baseProp) , filter);
bool vec3 = (propInfo.typeinfo() == proptype_Vec3d) || (propInfo.typeinfo() == proptype_Vec3f);
if (propInfo.typeinfo() == proptype_bool)
propertyVisualizers.push_back(new OMPropertyVisualizerBoolean<MeshT>(mesh, propInfo));
else if (propInfo.typeinfo() == proptype_int)
......@@ -550,6 +554,10 @@ void OMPropertyModel<MeshT>::addPropertyVisualizer(OpenMesh::BaseProperty* const
propertyVisualizers.push_back(new OMPropertyVisualizerDouble<MeshT>(mesh, propInfo));
else if ((propInfo.typeinfo() == proptype_Vec3d) || (propInfo.typeinfo() == proptype_Vec3f))
propertyVisualizers.push_back(new OMPropertyVisualizerVector<MeshT>(mesh, propInfo));
else if ((propInfo.typeinfo() == proptype_Vec2d))
propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2d>(mesh, propInfo));
else if ((propInfo.typeinfo() == proptype_Vec2f))
propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2f>(mesh, propInfo));
#ifdef ENABLE_SKELETON_SUPPORT
else if (propInfo.typeinfo() == proptype_SkinWeights)
propertyVisualizers.push_back(new OMPropertyVisualizerSkinWeights<MeshT>(mesh, propInfo));
......@@ -583,6 +591,16 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
OpenMesh::VPropHandleT< TriMesh::Point > prop;
mesh->add_property(prop, pname.toStdString());
}
else if (dtype == tr("Vec2d"))
{
OpenMesh::VPropHandleT< ACG::Vec2d > prop;
mesh->add_property(prop, pname.toStdString());
}
else if (dtype == tr("Vec2f"))
{
OpenMesh::VPropHandleT< ACG::Vec2f > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("double") )
{
OpenMesh::VPropHandleT< double > prop;
......@@ -620,6 +638,16 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
OpenMesh::EPropHandleT< TriMesh::Point > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("Vec2d") )
{
OpenMesh::EPropHandleT< ACG::Vec2d > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("Vec2f") )
{
OpenMesh::EPropHandleT< ACG::Vec2f > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("double") )
{
OpenMesh::EPropHandleT< double > prop;
......@@ -648,6 +676,16 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
OpenMesh::FPropHandleT< TriMesh::Point > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("Vec2d") )
{
OpenMesh::FPropHandleT< ACG::Vec2d > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("Vec2f") )
{
OpenMesh::FPropHandleT< ACG::Vec2f > prop;
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("double") )
{
OpenMesh::FPropHandleT< double > prop;
......@@ -712,6 +750,8 @@ void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
supportedPropertyTypes.insert(proptype_double);
supportedPropertyTypes.insert(proptype_Vec3d);
supportedPropertyTypes.insert(proptype_Vec3f);
supportedPropertyTypes.insert(proptype_Vec2d);
supportedPropertyTypes.insert(proptype_Vec2f);
#ifdef ENABLE_SKELETON_SUPPORT
supportedPropertyTypes.insert(proptype_SkinWeights);
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* 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 with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* 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 LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18129 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:25:53 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
#ifndef OM_PROPERTY_VISUALIZER_VECTOR2_HH
#define OM_PROPERTY_VISUALIZER_VECTOR2_HH
#include "OMPropertyVisualizer.hh"
#include <ACG/Scenegraph/LineNode.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenMesh/Core/Utils/PropertyManager.hh>
#include "Widgets/VectorWidget.hh"
#include <iostream>
#include <cmath>
template <typename MeshT, typename VectorType>
class OMPropertyVisualizerVector2 : public OMPropertyVisualizer<MeshT>{
public:
OMPropertyVisualizerVector2(MeshT* _mesh, PropertyInfo _propertyInfo);
virtual ~OMPropertyVisualizerVector2(){clear();}
virtual void clear();
protected:
virtual void visualizeFaceProp(bool _setDrawMode = true);
virtual void visualizeEdgeProp(bool _setDrawMode = true);
virtual void visualizeHalfedgeProp(bool _setDrawMode = true);
virtual void visualizeVertexProp(bool _setDrawMode = true);
virtual void visualizeFacePropOnEdges();
virtual void visualizeFacePropAsStrokes();
virtual void visualizeEdgePropAsStrokes();
virtual void visualizeHalfedgePropAsStrokes();
virtual void visualizeVertexPropAsStrokes();
virtual void removeProperty();
virtual void duplicateProperty();
virtual QString getPropertyText(unsigned int index);
virtual void setFacePropertyFromText(unsigned int index, QString text);
virtual void setEdgePropertyFromText(unsigned int index, QString text);
virtual void setHalfedgePropertyFromText(unsigned int index, QString text);
virtual void setVertexPropertyFromText(unsigned int index, QString text);
ACG::SceneGraph::LineNode* lineNode;
};
#if defined(INCLUDE_TEMPLATES) && !defined(OM_PROPERTY_VISUALIZER_VECTOR2_CC)
#include "OMPropertyVisualizerVector2T.cc"
#endif
#endif /* OM_PROPERTY_VISUALIZER_VECTOR2_HH */
This diff is collapsed.
......@@ -60,6 +60,10 @@ const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d");
const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec3f =
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f");
const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec2d =
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2d>), "Vec2d");
const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec2f =
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2f>), "Vec2f");
#ifdef ENABLE_SKELETON_SUPPORT
#include <ObjectTypes/Skeleton/BaseSkin.hh>
......@@ -78,15 +82,17 @@ const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::prop_types[]
proptype_double,
proptype_Vec3d,
proptype_Vec3f,
proptype_Vec2d,
proptype_Vec2f,
#ifdef ENABLE_SKELETON_SUPPORT
proptype_SkinWeights,
#endif
};
#ifdef ENABLE_SKELETON_SUPPORT
const PropertyNameListModel::TYPE_INFO_SET PropertyNameListModel::sane_prop_types(prop_types, prop_types + 7);
const PropertyNameListModel::TYPE_INFO_SET PropertyNameListModel::sane_prop_types(prop_types, prop_types + 9);
#else
const PropertyNameListModel::TYPE_INFO_SET PropertyNameListModel::sane_prop_types(prop_types, prop_types + 6);
const PropertyNameListModel::TYPE_INFO_SET PropertyNameListModel::sane_prop_types(prop_types, prop_types + 8);
#endif
const char *PropertyNameListModel::entity2str(ENTITY_FILTER entity) {
......
......@@ -213,6 +213,8 @@ class PropertyNameListModel: public QAbstractListModel {
static const TypeInfoWrapper proptype_double;
static const TypeInfoWrapper proptype_Vec3d;
static const TypeInfoWrapper proptype_Vec3f;
static const TypeInfoWrapper proptype_Vec2d;
static const TypeInfoWrapper proptype_Vec2f;
static const TypeInfoWrapper proptype_SkinWeights;
private:
......
......@@ -99,6 +99,16 @@ QString PropertyVisualizer::toStr(OpenMesh::Vec3d v)
return QObject::tr("( %1, %2, %3 )").arg(v[0]).arg(v[1]).arg(v[2]);
}
QString PropertyVisualizer::toStr(OpenMesh::Vec2d v)
{
return QObject::tr("( %1, %2 )").arg(v[0]).arg(v[1]);
}
QString PropertyVisualizer::toStr(OpenMesh::Vec2f v)
{
return QObject::tr("( %1, %2 )").arg(v[0]).arg(v[1]);
}
#ifdef ENABLE_SKELETON_SUPPORT
QString PropertyVisualizer::toStr(BaseSkin::SkinWeights sw)
{
......@@ -123,3 +133,21 @@ OpenMesh::Vec3d PropertyVisualizer::strToVec3d (QString str)
QStringList strList = s.split(QObject::tr(", "));
return OpenMesh::Vec3d(strList[0].toDouble(),strList[1].toDouble(),strList[2].toDouble());
}
OpenMesh::Vec2d PropertyVisualizer::strToVec2d (QString str)
{
QString s = str;
s.remove(0,2);
s.chop(2);
QStringList strList = s.split(QObject::tr(", "));
return OpenMesh::Vec2d(strList[0].toDouble(),strList[1].toDouble());
}
OpenMesh::Vec2f PropertyVisualizer::strToVec2f (QString str)
{
QString s = str;
s.remove(0,2);
s.chop(2);
QStringList strList = s.split(QObject::tr(", "));
return OpenMesh::Vec2f(strList[0].toFloat(),strList[1].toFloat());
}
......@@ -155,6 +155,8 @@ public:
static inline QString toStr(int i) { return QObject::tr("%1").arg(i); }
static inline QString toStr(unsigned int i) { return QObject::tr("%1").arg(i); }
static QString toStr(OpenMesh::Vec3d v);
static QString toStr(OpenMesh::Vec2d v);
static QString toStr(OpenMesh::Vec2f v);
#ifdef ENABLE_SKELETON_SUPPORT
static QString toStr(BaseSkin::SkinWeights sw);
#endif
......@@ -164,7 +166,8 @@ public:
static inline int strToInt (QString str) { return str.toInt(); }
static inline unsigned int strToUInt (QString str) { return str.toUInt(); }
static OpenMesh::Vec3d strToVec3d (QString str);
static OpenMesh::Vec2d strToVec2d (QString str);
static OpenMesh::Vec2f strToVec2f (QString str);
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment