multiple debug updates
This commit is contained in:
@@ -116,7 +116,7 @@
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintAngle.svg</normaloff>:/icons/constraints/Assembly_ConstraintAngle.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -157,7 +157,7 @@
|
||||
<string>Coincident</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintCoincidence.svg</normaloff>:/icons/constraints/Assembly_ConstraintCoincidence.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -198,7 +198,7 @@
|
||||
<string>Fix</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintLock.svg</normaloff>:/icons/constraints/Assembly_ConstraintLock.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -239,7 +239,7 @@
|
||||
<string>Distance</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintDistance.svg</normaloff>:/icons/constraints/Assembly_ConstraintDistance.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -280,7 +280,7 @@
|
||||
<string>Orientation</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintOrientation.svg</normaloff>:/icons/constraints/Assembly_ConstraintOrientation.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -321,7 +321,7 @@
|
||||
<string>Align</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintAlignment.svg</normaloff>:/icons/constraints/Assembly_ConstraintAlignment.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -422,6 +422,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -436,7 +439,7 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintBidirectional.svg</normaloff>:/icons/constraints/Assembly_ConstraintBidirectional.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -474,8 +477,8 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional2.svg</normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional2.svg</iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional1.svg</normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional1.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -509,8 +512,8 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional1.svg</normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional1.svg</iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional2.svg</normaloff>:/icons/constraints/Assembly_ConstraintUnidirectional2.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -566,7 +569,7 @@
|
||||
<string>Parallel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintParallel.svg</normaloff>:/icons/constraints/Assembly_ConstraintParallel.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -604,7 +607,7 @@
|
||||
<string>Equal</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintEqual.svg</normaloff>:/icons/constraints/Assembly_ConstraintEqual.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -645,7 +648,7 @@
|
||||
<string>Opposite</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintOpposite.svg</normaloff>:/icons/constraints/Assembly_ConstraintOpposite.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -686,7 +689,7 @@
|
||||
<string>Perpend.</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="Resources/Assembly.qrc">
|
||||
<normaloff>:/icons/constraints/Assembly_ConstraintPerpendicular.svg</normaloff>:/icons/constraints/Assembly_ConstraintPerpendicular.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -729,6 +732,7 @@
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../Gui/Icons/resource.qrc"/>
|
||||
<include location="Resources/Assembly.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -25,20 +25,35 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoGroup.h>
|
||||
#include <Inventor/nodes/SoAnnotation.h>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
#include <Inventor/nodes/SoDrawStyle.h>
|
||||
#endif
|
||||
|
||||
#include "ViewProviderPart.h"
|
||||
//#include <Gui/Command.h>
|
||||
//#include <Gui/Document.h>
|
||||
#include <Mod/Assembly/App/ItemPart.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
using namespace AssemblyGui;
|
||||
|
||||
#ifdef ASSEMBLY_DEBUG_FACILITIES
|
||||
SbColor PointColor(1.0f,0.0f,0.0f);
|
||||
SbColor PseudoColor(0.0f,0.0f,1.0f);
|
||||
SbColor MidpointColor(0.0f,1.0f,1.0f);
|
||||
SbColor ZeroColor(1.0f,1.0f,0.0f);
|
||||
#endif
|
||||
|
||||
PROPERTY_SOURCE(AssemblyGui::ViewProviderItemPart,AssemblyGui::ViewProviderItem)
|
||||
|
||||
ViewProviderItemPart::ViewProviderItemPart()
|
||||
{
|
||||
sPixmap = "Assembly_Assembly_Part_Tree.svg";
|
||||
sPixmap = "Assembly_Assembly_Part_Tree.svg";
|
||||
|
||||
#ifdef ASSEMBLY_DEBUG_FACILITIES
|
||||
ADD_PROPERTY(ShowScalePoints,(false));
|
||||
#endif
|
||||
}
|
||||
|
||||
ViewProviderItemPart::~ViewProviderItemPart()
|
||||
@@ -50,22 +65,46 @@ bool ViewProviderItemPart::doubleClicked(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderItemPart::attach(App::DocumentObject *pcFeat)
|
||||
void ViewProviderItemPart::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
// call parent attach method
|
||||
ViewProviderGeometryObject::attach(pcFeat);
|
||||
|
||||
|
||||
// putting all together with the switch
|
||||
addDisplayMaskMode(getChildRoot(), "Main");
|
||||
|
||||
#ifdef ASSEMBLY_DEBUG_FACILITIES
|
||||
|
||||
m_anno = new SoAnnotation;
|
||||
m_switch = new SoSwitch;
|
||||
m_switch->addChild(m_anno);
|
||||
|
||||
m_material = new SoMaterial;
|
||||
m_anno->addChild(m_material);
|
||||
|
||||
SoMaterialBinding* MtlBind = new SoMaterialBinding;
|
||||
MtlBind->value = SoMaterialBinding::PER_VERTEX;
|
||||
m_anno->addChild(MtlBind);
|
||||
|
||||
m_pointsCoordinate = new SoCoordinate3;
|
||||
m_anno->addChild(m_pointsCoordinate);
|
||||
|
||||
SoDrawStyle* DrawStyle = new SoDrawStyle;
|
||||
DrawStyle->pointSize = 8;
|
||||
m_anno->addChild(DrawStyle);
|
||||
m_points = new SoMarkerSet;
|
||||
m_points->markerIndex = SoMarkerSet::CIRCLE_FILLED_7_7;
|
||||
m_anno->addChild(m_points);
|
||||
|
||||
pcRoot->addChild(m_switch);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViewProviderItemPart::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
if ( strcmp("Main",ModeName)==0 )
|
||||
if(strcmp("Main",ModeName)==0)
|
||||
setDisplayMaskMode("Main");
|
||||
|
||||
ViewProviderGeometryObject::setDisplayMode( ModeName );
|
||||
ViewProviderGeometryObject::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderItemPart::getDisplayModes(void) const
|
||||
@@ -83,9 +122,10 @@ std::vector<App::DocumentObject*> ViewProviderItemPart::claimChildren(void)const
|
||||
{
|
||||
std::vector<App::DocumentObject*> res;
|
||||
|
||||
res.insert( res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
|
||||
res.insert(res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
|
||||
|
||||
if(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue())
|
||||
res.push_back( static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
|
||||
res.push_back(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
|
||||
|
||||
return res;
|
||||
|
||||
@@ -95,10 +135,104 @@ std::vector<App::DocumentObject*> ViewProviderItemPart::claimChildren3D(void)con
|
||||
{
|
||||
std::vector<App::DocumentObject*> res;
|
||||
|
||||
res.insert( res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
|
||||
res.insert(res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
|
||||
|
||||
if(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue())
|
||||
res.push_back( static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
|
||||
res.push_back(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
#ifdef ASSEMBLY_DEBUG_FACILITIES
|
||||
|
||||
void ViewProviderItemPart::onChanged(const App::Property* prop) {
|
||||
|
||||
if(prop == &ShowScalePoints) {
|
||||
if(ShowScalePoints.getValue()) {
|
||||
m_switch->whichChild = 0;
|
||||
|
||||
int counter = 0;
|
||||
boost::shared_ptr<Part3D> part = static_cast<Assembly::ItemPart*>(getObject())->m_part;
|
||||
|
||||
if(!part) {
|
||||
ViewProviderItem::onChanged(prop);
|
||||
return;
|
||||
}
|
||||
|
||||
dcm::detail::Transform<double,3> transform = part->m_cluster->getProperty<Module3D::type<Solver>::math_prop>().m_transform;
|
||||
dcm::detail::Transform<double,3> ssrTransform = part->m_cluster->getProperty<Module3D::type<Solver>::math_prop>().m_ssrTransform;
|
||||
|
||||
dcm::detail::Transform<double,3> trans = ssrTransform.inverse();
|
||||
|
||||
int PseudoSize = part->m_cluster->getProperty<Module3D::type<Solver>::math_prop>().m_pseudo.size();
|
||||
typedef dcm::details::ClusterMath<Solver>::Vec Vector;
|
||||
Vector& pv = part->m_cluster->getProperty<Module3D::type<Solver>::math_prop>().m_points;
|
||||
|
||||
for(Vector::iterator it = pv.begin(); it != pv.end(); it++) {
|
||||
|
||||
Kernel::Vector3 vec = trans * (*it);
|
||||
m_pointsCoordinate->point.set1Value(counter, SbVec3f(vec(0),vec(1),vec(2)));
|
||||
|
||||
if(counter < PseudoSize)
|
||||
m_material->diffuseColor.set1Value(counter, PseudoColor);
|
||||
else
|
||||
m_material->diffuseColor.set1Value(counter, PointColor);
|
||||
|
||||
counter++;
|
||||
};
|
||||
|
||||
//midpoint
|
||||
Kernel::Vector3 midpoint = trans * Kernel::Vector3(0,0,0);
|
||||
|
||||
m_pointsCoordinate->point.set1Value(counter, SbVec3f(midpoint(0),midpoint(1),midpoint(2)));
|
||||
|
||||
m_material->diffuseColor.set1Value(counter, MidpointColor);
|
||||
|
||||
counter++;
|
||||
|
||||
//origin
|
||||
Kernel::Vector3 origin = Kernel::Vector3(0,0,0);
|
||||
|
||||
m_pointsCoordinate->point.set1Value(counter, SbVec3f(origin(0),origin(1),origin(2)));
|
||||
|
||||
m_material->diffuseColor.set1Value(counter, ZeroColor);
|
||||
|
||||
counter++;
|
||||
|
||||
m_points->numPoints = counter;
|
||||
|
||||
//test
|
||||
boost::shared_ptr<Geometry3D> g = part->m_cluster->getProperty<Module3D::type<Solver>::math_prop>().m_geometry[0];
|
||||
|
||||
std::stringstream str;
|
||||
|
||||
str<<"Global: "<<g->m_global.transpose()<<std::endl;
|
||||
|
||||
str<<"Global TLPoint: "<<(trans * g->getPoint()).transpose()<<std::endl;
|
||||
|
||||
Kernel::Vector3 v = g->m_global.head(3);
|
||||
|
||||
str<<"Local Point : "<<(transform.inverse()*v).transpose()<<std::endl;
|
||||
|
||||
str<<"Local TLPoint: "<<(ssrTransform.inverse()*g->getPoint()).transpose()<<std::endl;
|
||||
|
||||
str<<"PVPoint : "<<(pv[0]).transpose()<<std::endl;
|
||||
|
||||
str<<"Local PVPoint: "<<(ssrTransform.inverse()*pv[0]).transpose()<<std::endl;
|
||||
|
||||
Base::Console().Message(str.str().c_str());
|
||||
|
||||
}
|
||||
else {
|
||||
m_switch->whichChild = -1;
|
||||
m_pointsCoordinate->point.setValues(0, 0, (SbVec3f*)NULL);
|
||||
m_material->diffuseColor.setValues(0, 0, (SbColor*)NULL);
|
||||
m_points->numPoints = 0;
|
||||
}
|
||||
};
|
||||
|
||||
ViewProviderItem::onChanged(prop);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
#define ASSEMBLYGUI_ViewProviderPart_H
|
||||
|
||||
#include "ViewProvider.h"
|
||||
#include <Inventor/nodes/SoAnnotation.h>
|
||||
#include <Inventor/nodes/SoMarkerSet.h>
|
||||
#include <Inventor/nodes/SoCoordinate3.h>
|
||||
#include <Inventor/nodes/SoMaterial.h>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
|
||||
|
||||
namespace AssemblyGui {
|
||||
@@ -49,7 +54,18 @@ public:
|
||||
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||
|
||||
virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
|
||||
|
||||
|
||||
#ifdef ASSEMBLY_DEBUG_FACILITIES
|
||||
//draw the dcm points
|
||||
SoAnnotation* m_anno;
|
||||
SoSwitch* m_switch;
|
||||
SoMaterial* m_material;
|
||||
SoCoordinate3* m_pointsCoordinate;
|
||||
SoMarkerSet* m_points;
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
App::PropertyBool ShowScalePoints;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user