meshmanagermodel
-150.374274:130.740991:-900.000000
FIN_COMPLEX_PORT
-BOXES:84
+BOXES:75
BOX
creaMaracasVisu:ShowNPoints:showNpoints
ISEXEC:FALSE
BOX
wx:LayoutLine:Box79
ISEXEC:FALSE
--144.841026:-82.628158:-900.000000
--111.521026:-85.128158:-900.000000
+-143.046813:-112.731071:-900.000000
+-109.726813:-115.231071:-900.000000
PORT
Orientation:"H"
PORT
BOX
wx:LayoutLine:Box38
ISEXEC:FALSE
--190.854929:-82.522396:-900.000000
--157.534929:-85.022396:-900.000000
+-189.060716:-112.625309:-900.000000
+-155.740716:-115.125309:-900.000000
PORT
Orientation:"H"
PORT
BOX
wx:LayoutTab:Box39
ISEXEC:FALSE
--195.888488:-89.508403:-900.000000
--162.568488:-92.008403:-900.000000
+-194.094275:-119.611316:-900.000000
+-160.774275:-122.111316:-900.000000
FIN_BOX
BOX
wx:LayoutTab:Box40
ISEXEC:FALSE
--148.825313:-89.038628:-900.000000
--115.505313:-91.538628:-900.000000
+-147.031100:-119.141541:-900.000000
+-113.711100:-121.641541:-900.000000
FIN_BOX
BOX
wx:CommandButton:Box42
BOX
wx:LayoutLine:Box50
ISEXEC:FALSE
--42.742907:-58.168804:-900.000000
--9.422907:-60.668804:-900.000000
+-26.479356:-58.435420:-900.000000
+6.840644:-60.935420:-900.000000
PORT
Orientation:"V"
PORT
BOX
wx:LayoutLine:Box81
ISEXEC:FALSE
--184.734921:-96.564525:-900.000000
--151.414921:-99.064525:-900.000000
+-182.940708:-126.667438:-900.000000
+-149.620708:-129.167438:-900.000000
PORT
WinTitle:"Step 1. Surface"
FIN_BOX
BOX
wx:LayoutTab:Box86
ISEXEC:FALSE
--55.020341:-67.071239:-900.000000
--21.700341:-69.571239:-900.000000
+-54.839107:-68.339875:-900.000000
+-21.519107:-70.839875:-900.000000
FIN_BOX
BOX
creaVtk:MeshManager:Box92
BOX
wx:ComboBox:Box108
ISEXEC:FALSE
--63.731818:76.682466:-900.000000
--37.451818:74.182466:-900.000000
+135.425863:49.171195:-900.000000
+161.705863:46.671195:-900.000000
FIN_BOX
BOX
std:AddStringToVector:Box109
In1:"Tool - Join start and end points to current spline"
FIN_BOX
BOX
-creaMaracasVisu:ShowNPoints_Tools:Box116
-ISEXEC:FALSE
-83.181891:-37.997829:-900.000000
-105.726891:-40.497829:-900.000000
-PORT
-BoxProcessMode:"Manual"
-PORT
-Params:" -1"
-PORT
-Type:"230"
-FIN_BOX
-BOX
-wx:CommandButton:Box117
-ISEXEC:FALSE
-100.839007:-14.508839:-900.000000
-123.224007:-17.008839:-900.000000
-PORT
-Label:"-"
-FIN_BOX
-BOX
-wx:LayoutLine:Box118
-ISEXEC:FALSE
-94.757325:-47.167548:-900.000000
-128.077325:-49.667548:-900.000000
-PORT
-Orientation:"H"
-FIN_BOX
-BOX
-wx:CommandButton:Box119
-ISEXEC:FALSE
-131.048147:-14.696561:-900.000000
-153.433147:-17.196561:-900.000000
-PORT
-Label:"+"
-FIN_BOX
-BOX
-creaMaracasVisu:ShowNPoints_Tools:Box120
-ISEXEC:FALSE
-118.818739:-37.869439:-900.000000
-141.363739:-40.369439:-900.000000
-PORT
-BoxProcessMode:"Manual"
-PORT
-Params:" 1"
-PORT
-Type:"230"
-FIN_BOX
-BOX
wx:LayoutLine:Box121
ISEXEC:FALSE
-100.845652:-78.053543:-900.000000
-134.165652:-80.553543:-900.000000
+-55.608595:-58.187882:-900.000000
+-22.288595:-60.687882:-900.000000
PORT
Orientation:"V"
PORT
WinTitle:"1.1 Splines"
FIN_BOX
BOX
-creaMaracasVisu:ShowNPoints_Tools:Box122
-ISEXEC:FALSE
-165.760712:-38.975325:-900.000000
-188.305712:-41.475325:-900.000000
-PORT
-BoxProcessMode:"Manual"
-PORT
-Params:"-1"
-PORT
-Type:"235"
-FIN_BOX
-BOX
-wx:CommandButton:Box123
-ISEXEC:FALSE
-183.417828:-15.486335:-900.000000
-205.802828:-17.986335:-900.000000
-PORT
-Label:"<"
-FIN_BOX
-BOX
-wx:LayoutLine:Box124
+wx:LayoutLine:Box127
ISEXEC:FALSE
-167.780189:-48.474560:-900.000000
-201.100189:-50.974560:-900.000000
+-46.207243:29.221590:-900.000000
+-12.887243:26.721590:-900.000000
PORT
Orientation:"H"
FIN_BOX
BOX
-wx:CommandButton:Box125
+wx:OutputText:Box131
ISEXEC:FALSE
-213.626968:-15.674057:-900.000000
-236.011968:-18.174057:-900.000000
-PORT
-Label:">"
+-17.624192:-45.101554:-900.000000
+4.155808:-47.601554:-900.000000
FIN_BOX
BOX
-creaMaracasVisu:ShowNPoints_Tools:Box126
+creaMaracasVisu:ShowNPoints_Tools:Box132
ISEXEC:FALSE
-201.397560:-38.846935:-900.000000
-223.942560:-41.346935:-900.000000
+60.800054:-98.532649:-900.000000
+83.345054:-101.032649:-900.000000
PORT
BoxProcessMode:"Manual"
PORT
-Params:"1"
-PORT
-Type:"235"
-FIN_BOX
-BOX
-wx:LayoutLine:Box127
-ISEXEC:FALSE
--46.207243:29.221590:-900.000000
--12.887243:26.721590:-900.000000
-PORT
-Orientation:"H"
+Type:"250"
FIN_BOX
BOX
-wx:LayoutLine:Box130
+std:ConcatStrings:Box120
ISEXEC:FALSE
-108.922083:-61.432768:-900.000000
-142.242083:-63.932768:-900.000000
-PORT
-Orientation:"V"
-FIN_BOX
-BOX
-wx:OutputText:Box131
-ISEXEC:FALSE
--17.624192:-45.101554:-900.000000
-4.155808:-47.601554:-900.000000
+134.627918:41.900202:-900.000000
+157.387918:39.400202:-900.000000
FIN_BOX
-CONNECTIONS:169
+CONNECTIONS:156
CONNECTION
Box06:LstContourPointsX:Box04:LstX
NumberOfControlPoints:0
Box49:OutString:Box29:NbPoints
NumberOfControlPoints:0
CONNECTION
-showNpoints:WidgetShowNPoints:Box116:WidgetShowNPoints
-NumberOfControlPoints:0
-CONNECTION
-Box68:Spacing:Box116:Spacing
-NumberOfControlPoints:0
-CONNECTION
-Box117:BoxChange:Box116:BoxExecute
-NumberOfControlPoints:0
-CONNECTION
-Box117:Widget:Box118:Widget2
-NumberOfControlPoints:0
-CONNECTION
-Box119:Widget:Box118:Widget3
-NumberOfControlPoints:0
-CONNECTION
-Box119:BoxChange:Box120:BoxExecute
-NumberOfControlPoints:0
-CONNECTION
-showNpoints:WidgetShowNPoints:Box120:WidgetShowNPoints
-NumberOfControlPoints:0
-CONNECTION
-Box68:Spacing:Box120:Spacing
-NumberOfControlPoints:0
-CONNECTION
-Box105:Out:Box116:Mesh
-NumberOfControlPoints:0
-CONNECTION
-Box105:Out:Box120:Mesh
-NumberOfControlPoints:0
-CONNECTION
showNpoints:Widget:Box121:Widget1
NumberOfControlPoints:0
CONNECTION
Box121:Widget:Box86:Widget2
NumberOfControlPoints:0
CONNECTION
-Box123:BoxChange:Box122:BoxExecute
-NumberOfControlPoints:0
-CONNECTION
-Box123:Widget:Box124:Widget2
-NumberOfControlPoints:0
-CONNECTION
-Box125:Widget:Box124:Widget3
-NumberOfControlPoints:0
-CONNECTION
-Box125:BoxChange:Box126:BoxExecute
+Box108:Widget:Box127:Widget2
NumberOfControlPoints:0
CONNECTION
-showNpoints:WidgetShowNPoints:Box122:WidgetShowNPoints
+Box127:Widget:Box50:Widget6
NumberOfControlPoints:0
CONNECTION
-showNpoints:WidgetShowNPoints:Box126:WidgetShowNPoints
+Box106:Widget:Box127:Widget5
NumberOfControlPoints:0
CONNECTION
-Box108:Widget:Box127:Widget2
+Box103:Widget:Box50:Widget7
NumberOfControlPoints:0
CONNECTION
-Box127:Widget:Box50:Widget6
+Box131:Widget:Box50:Widget9
NumberOfControlPoints:0
CONNECTION
-Box130:Widget:Box121:Widget3
+showNpoints:WidgetShowNPoints:Box132:WidgetShowNPoints
NumberOfControlPoints:0
CONNECTION
-Box106:Widget:Box127:Widget5
+Box68:Spacing:Box132:Spacing
NumberOfControlPoints:0
CONNECTION
-Box103:Widget:Box50:Widget7
+Box105:Out:Box132:Mesh
NumberOfControlPoints:0
CONNECTION
-Box131:Widget:Box50:Widget9
+Box105:BoxChange:Box132:BoxExecute
NumberOfControlPoints:0
CONNECTION
-Box124:Widget:Box130:Widget1
+Box108:Out:Box120:In1
NumberOfControlPoints:0
CONNECTION
-Box118:Widget:Box130:Widget3
+Box120:Out:Box132:Params
NumberOfControlPoints:0
APP_END
set Box115.In0 "Tool - Inverse Normals"
set Box115.In1 "Tool - Join start and end points to current spline"
-new creaMaracasVisu:ShowNPoints_Tools Box116
- set Box116.BoxProcessMode "Manual"
- set Box116.Params " -1"
- set Box116.Type "230"
-
-new wx:CommandButton Box117
- set Box117.Label "-"
-
-new wx:LayoutLine Box118
- set Box118.Orientation "H"
-
-new wx:CommandButton Box119
- set Box119.Label "+"
-
-new creaMaracasVisu:ShowNPoints_Tools Box120
- set Box120.BoxProcessMode "Manual"
- set Box120.Params " 1"
- set Box120.Type "230"
-
new wx:LayoutLine Box121
set Box121.Orientation "V"
set Box121.WinTitle "1.1 Splines"
-new creaMaracasVisu:ShowNPoints_Tools Box122
- set Box122.BoxProcessMode "Manual"
- set Box122.Params "-1"
- set Box122.Type "235"
-
-new wx:CommandButton Box123
- set Box123.Label "<"
-
-new wx:LayoutLine Box124
- set Box124.Orientation "H"
-
-new wx:CommandButton Box125
- set Box125.Label ">"
-
-new creaMaracasVisu:ShowNPoints_Tools Box126
- set Box126.BoxProcessMode "Manual"
- set Box126.Params "1"
- set Box126.Type "235"
-
new wx:LayoutLine Box127
set Box127.Orientation "H"
-new wx:LayoutLine Box130
- set Box130.Orientation "V"
-
new wx:OutputText Box131
+new creaMaracasVisu:ShowNPoints_Tools Box132
+ set Box132.BoxProcessMode "Manual"
+ set Box132.Type "250"
+
+new std:ConcatStrings Box120
+
connect Box06.LstContourPointsX Box04.LstX
connect showNpoints.lstIndexs Box06.LstIndexsIn
connect Box115.Out Box57.In
connect Box67.Out Box60.Mesh
connect Box49.OutString Box29.NbPoints
-connect showNpoints.WidgetShowNPoints Box116.WidgetShowNPoints
-connect Box68.Spacing Box116.Spacing
-connect Box117.BoxChange Box116.BoxExecute
-connect Box117.Widget Box118.Widget2
-connect Box119.Widget Box118.Widget3
-connect Box119.BoxChange Box120.BoxExecute
-connect showNpoints.WidgetShowNPoints Box120.WidgetShowNPoints
-connect Box68.Spacing Box120.Spacing
-connect Box105.Out Box116.Mesh
-connect Box105.Out Box120.Mesh
connect showNpoints.Widget Box121.Widget1
connect Box121.Widget Box86.Widget2
-connect Box123.BoxChange Box122.BoxExecute
-connect Box123.Widget Box124.Widget2
-connect Box125.Widget Box124.Widget3
-connect Box125.BoxChange Box126.BoxExecute
-connect showNpoints.WidgetShowNPoints Box122.WidgetShowNPoints
-connect showNpoints.WidgetShowNPoints Box126.WidgetShowNPoints
connect Box108.Widget Box127.Widget2
connect Box127.Widget Box50.Widget6
-connect Box130.Widget Box121.Widget3
connect Box106.Widget Box127.Widget5
connect Box103.Widget Box50.Widget7
connect Box131.Widget Box50.Widget9
-connect Box124.Widget Box130.Widget1
-connect Box118.Widget Box130.Widget3
+connect showNpoints.WidgetShowNPoints Box132.WidgetShowNPoints
+connect Box68.Spacing Box132.Spacing
+connect Box105.Out Box132.Mesh
+connect Box105.BoxChange Box132.BoxExecute
+connect Box108.Out Box120.In1
+connect Box120.Out Box132.Params
# Complex input ports
input point showNpoints.In " "
else{
printf("PG ShowNPoints_Tools::CreatePatch_Npoints Warning patch not apply. groups or mesh invalid. Need 1 group of 3 or 4 points, and a mesh\n");
} // if wsp && mesh
+
+ // --- Finish ---
+ wsp->RefreshCollectionText();
+ wsp->RefreshColourCollection();
+ wsp->SetOutputBox();
+ wsp->UndoRedo_SaveCollection();
+
}
void ShowNPoints_Tools::InitCreateVolumeSurface_Points()
wsp->InsertPoint(pN[0] ,pN[1], pN[2],"");
wsp->InsertPoint(pC3[0] ,pC3[1], pC3[2],"");
-
-
+
// Add points to the other Groups
std::vector<double> pointStart;
pointStart.push_back( pC1[0] );
wsp->OnInsertPoint_();
// --- Finish ---
+ wsp->RefreshCollectionText();
+ wsp->RefreshColourCollection();
wsp->SetOutputBox();
wsp->UndoRedo_SaveCollection();
+ pointLocator->Delete();
+
} // if wsp && mesh
}
pN[2] = p[2] / spc[2] + direction*normal[2];
wsp->GetModelShowNPoints()->SetPointById(idControlPoint, pN);
- wsp->GetViewShowNPoints()->RefreshPoint(idControlPoint);
+// wsp->GetViewShowNPoints()->RefreshPoint(idControlPoint);
+ wsp->RefreshCollectionText();
+ wsp->RefreshColourCollection();
wsp->SetOutputBox();
wsp->UndoRedo_SaveCollection();
} // if idControlPoint
- } //wsp
+ } // if wsp->GetLstModelShowNPointsSiz->size()>=2
}
void ShowNPoints_Tools::ChangeCurrentPoint()
} // if Size
}
+void ShowNPoints_Tools::SetMesh()
+{
+ WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
+ wsp->SetAuxMesh(bbGetInputMesh(), bbGetInputSpacing(), bbGetInputParams() );
+}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
{
ChangeCurrentPoint();
} // if Type
-
if(bbGetInputType()==240)
{
JoinPoints();
} // if Type
+ if(bbGetInputType()==250)
+ {
+ SetMesh();
+ } // if Type
if(bbGetInputType()==300)
{
CreateExpandedSurface();
void ExpandPatch();
void MovePointInNormal();
void JoinPoints();
+ void SetMesh();
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
BBTK_INPUT(ShowNPoints_Tools,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,"");
BBTK_INPUT(ShowNPoints_Tools,Spacing,"(default [1,1,1] )Spacing",std::vector<double>,"");
BBTK_INPUT(ShowNPoints_Tools,Mesh,"Mesh en format vtkPolyData ",vtkPolyData*,"");
- BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points) 205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points) 210: Invert points 220: Move patch center 230: Move point in normal of surface 240: Join all start-end points to the start-end points on selected spline 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,"");
+ BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points) 205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points) 210: Invert points 220: Move patch center 230: Move point in normal of surface (Params [-1] or [1]) 235: ChangeCurrentPoint (Params [-1] or [1]) 240: Join all start-end points to the start-end points on selected spline 250: Set Mesh SPC (Params: [0]:Patch [1]:CloseSpline1 [2]:CloseSpline2) 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,"");
BBTK_INPUT(ShowNPoints_Tools, Params,"Optional params for the tools, required for 200: normal and direction, 320: centroid and direction, 330: normal and direction, 340: centroid and direction", std::vector<double>,"");
BBTK_OUTPUT(ShowNPoints_Tools, Out, "Output", std::vector<double>, "");
//----------------------------------------------------------------------
ModelShowNPoints::ModelShowNPoints()
{
- firsttime=true;
- idCurrentPoint = -1;
+ firsttime = true;
+ idCurrentPoint = -1;
}
//----------------------------------------------------------------------
lstPointsX.push_back( x );
lstPointsY.push_back( y );
lstPointsZ.push_back( z );
- std::string strLabel = CleanSpaces( label );
+ std::string strLabel = CleanSpaces( label );
lstLabels.push_back( strLabel );
+ idCurrentPoint = lstPointsX.size()-1;
}
//------------------------------------------------------------------------
{
smallTMP=dTotal[j];
pos = j+1;
- }
- }
+ } // if
+ } // for j
// *************** Open contour case Start *******************
pos=0;
} else { // after second point
pos=2;
- }
- }
- }
+ } // if a<b
+ } // if r1<r2
+ } // lstPointsX.size == 2
+
if (lstPointsX.size()>2)
{
double r3;
if (b>r3) // outside circle
{
pos = 0;
- }
- }
+ } // if b>r3
+ } // if pos
if (pos==lstPointsX.size()-1 ) // last point of the list
{
i = lstPointsX.size()-2;
if (a>r3) // outside circle
{
pos = pos+1;
- }
- }
- }
+ } // if a>r3
+ } // if pos
+ } // if lstPointsX.size
// *************** Open contour case End *******************
itS = lstLabels.begin();
//Insert Label in list of labels
lstLabels.insert( itS+pos, strLabel );
- return pos;
+ idCurrentPoint=pos;
+ return pos;
} else {
return -1;
}// if size lst X
lstPointsY.erase( lstPointsY.begin()+id );
lstPointsZ.erase( lstPointsZ.begin()+id );
lstLabels.erase( lstLabels.begin()+id );
+ SetIdCurrentPoint(id);
}
//----------------------------------------------------------------------
#include <creaContoursFactory.h>
+#include <vtkStaticPointLocator.h>
+#include <vtkPointData.h>
+#include <vtkDataArray.h>
+#include <vtkMath.h>
+#include <vtkStaticPointLocator.h>
+#include <vtkPoints.h>
+
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
+ aux_mesh = NULL;
+ aux_mesh_spc.push_back(1);
+ aux_mesh_spc.push_back(1);
+ aux_mesh_spc.push_back(1);
+ aux_mesh_type = 0; // 0:Patch 1:CloseSpline1 2:CloseSpline2
+
// EED 2022-05-19
// mmodelShowNPoints = new ModelShowNPoints();
idUndoRedo = 0;
UndoRedoDir = std::string("");
} else {
UndoRedoDir = std::string(val)+"\\creatools";
- printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this );
std::string cmd1 = "mkdir "+ UndoRedoDir;
system( cmd1.c_str() );
// Erasing files of more than 1 day old ( -1 )
UndoRedoDir = "/tmp/creatools";
#endif
- printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this );
std::string cmd1 = "mkdir "+ UndoRedoDir;
system( cmd1.c_str() );
// Erasing files of more than 1 day old ( +1 )
wxPanel* panel = NULL;
wxPanel* panel2 = NULL;
txtNrCollections = NULL;
+ txtNrPoints = NULL;
bookSetPoints = new wxNotebook(panelParent,
-1,
wxDefaultPosition,
wxDefaultSize,
wxNB_TOP );
panel = new wxPanel(bookSetPoints);
- txtNrCollections = NULL;
wxSize sizeButton;
sizeButton.Set( 45 , -1 );
Connect(btnNextPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint);
Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
Connect(btnInsertPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
+ Connect(btnMovePointUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp);
+ Connect(btnMovePointDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown);
Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
Connect(btnRenamePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint);
Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
wxStaticText* txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radio ")));
sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
- Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
- Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+ Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+ Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
- wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
sizer1->Add(btnSetPositionPoint);
sizer1->Add(txtNrPoints);
sizer1->Add(txRadio);
if (mtype == 2)
{
askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
- wxButton *btnAddPoint = new wxButton(panel, -1, _T(" Add Point "));
- wxButton *btnDeleteAllPoints = new wxButton(panel, -1, _T(" Delete All "));
+ wxButton *btnAddPoint = new wxButton(panel , -1, _T(" Add Point "));
+ wxButton *btnDeleteAllPoints = new wxButton(panel , -1, _T(" Delete All "));
wxStaticText *spacer = new wxStaticText(panel, -1, _T("\n")); // JPR
textCtrl = new wxTextCtrl(panel, -1);
Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event)
{
- SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
+ SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
}
void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event)
{
- SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
+ SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
}
//------------------------------------------------------------------------
void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
{
- printf("WidgetShowNPoints::AddPoint 0 model=%p\n", GetModelShowNPoints() );
GetModelShowNPoints()->AddPoint(x,y,z, label );
// EED 2022-05-19
//AddVtkPoint();
//RefreshPoint(lstActorsSphere.size()-1);
- printf("WidgetShowNPoints::AddPoint 1 view=%p\n", GetViewShowNPoints() );
GetViewShowNPoints()->AddPoint();
- printf("WidgetShowNPoints::AddPoint 2\n");
}
//------------------------------------------------------------------------
} else {//mpoint.size
printf("creaMaracasVisu::ShowNPoints (not match point) \n");
}
+ RefreshCollectionText();
+ RefreshColourCollection();
+
UndoRedo_SaveCollection();
}
// EED 2022-05-19
//renderer->GetRenderWindow()->Render();
GetViewShowNPoints()->Render();
+ UndoRedo_SaveCollection();
} else {//mpoint.size
printf("creaMaracasVisu::ShowNPoints (not match point) \n");
}
- UndoRedo_SaveCollection();
}
void WidgetShowNPoints::OnAddPoint_()
if ( cbAutoAddPoints->GetValue() == true )
{
OnAddPoint__();
+ RefreshCollectionText();
+ RefreshColourCollection();
} // if cbAutoAddPoints
}
void WidgetShowNPoints::OnAutoAddPoints_()
{
StopTrackPoint();
- printf("EED WidgetShowNPoints::OnAutoAddPoints_ \n");
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnAutoAddPoints(wxCommandEvent& event)
{
StopTrackPoint();
- printf("EED WidgetShowNPoints::OnAutoAddPoints \n");
}
//------------------------------------------------------------------------
{
//EED renderer->GetRenderWindow()->Render();
wxString strTmp;
- strTmp.Printf(_T("Nbr pnts: %d"), GetModelShowNPoints()->GetLstPointsSize() );
+ wxString strTmp2;
+ if (GetModelShowNPoints()->GetIdCurrentPoint()<0)
+ {
+ strTmp2.Printf(_T(" -- / %d") , GetModelShowNPoints()->GetLstPointsSize() );
+ } else {
+ strTmp.Printf(_T(" %d / %d"), GetModelShowNPoints()->GetIdCurrentPoint()+1 , GetModelShowNPoints()->GetLstPointsSize() );
+ }// if IdCurrent<0
txtNrPoints->SetLabel( strTmp );
//--BBTK
StopAutoAddPoints();
StopTrackPoint();
- int id=GetModelShowNPoints()->GetNearestPoint();
+ //int id=GetModelShowNPoints()->GetNearestPoint();
+ int id=GetModelShowNPoints()->GetIdCurrentPoint();
+
if((id==-1) && (mtype==1))
{
id=0;
GetViewShowNPoints()->RefreshPoint(id);
GetViewShowNPoints()->Render();
} // if id
+ RefreshCollectionText();
+ RefreshColourCollection();
SetOutputBox();
UndoRedo_SaveCollection();
}
OnSetPoint_();
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::MovePoint_(double step)
+{
+ step=step*2;
+
+ StopAutoAddPoints();
+ StopTrackPoint();
+
+ int id=GetModelShowNPoints()->GetIdCurrentPoint();
+ if (aux_mesh!=NULL)
+ {
+ if((GetLstModelShowNPointsSize()>=2) //Check condition
+ && (GetModelShowNPoints()->GetLstPointsSize()>0)
+ && (aux_mesh != NULL)
+ && (aux_mesh_spc.size() == 3))
+ {
+ double x,y,z;
+ double p[3];
+ double normal[3];; // point to modify and normal
+ std::vector<double> pN(3); // new point
+ vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( aux_mesh );
+ pointLocator->BuildLocator();
+
+ // int idControlPoint = wsp->GetModelShowNPoints()->GetNearestPoint();
+ int idControlPoint = GetModelShowNPoints()->GetIdCurrentPoint();
+
+ if(idControlPoint >= 0)
+ {
+ GetModelShowNPoints()->GetIdPoint(idControlPoint, &x, &y, &z);
+ p[0] = x * aux_mesh_spc[0];
+ p[1] = y * aux_mesh_spc[1];
+ p[2] = z * aux_mesh_spc[2];
+ int idMeshPoint = pointLocator->FindClosestPoint(p);
+ aux_mesh->GetPointData()->GetNormals()->GetTuple(idMeshPoint, normal);
+ int direction = step;
+// pN[0] = p[0] / spc[0] + direction*normal[0];
+// pN[1] = p[1] / spc[1] + direction*normal[1];
+// pN[2] = p[2] / spc[2] + direction*normal[2];
+ pN[0] = x + direction*normal[0];
+ pN[1] = y + direction*normal[1];
+ pN[2] = z + direction*normal[2];
+
+ GetModelShowNPoints()->SetPointById(idControlPoint, pN);
+ // GetViewShowNPoints()->RefreshPoint(idControlPoint);
+// RefreshCollectionText();
+// RefreshColourCollection();
+// SetOutputBox();
+ UndoRedo_SaveCollection();
+ } // if idControlPoint
+ } // if wsp->GetLstModelShowNPointsSiz->size()>=2
+
+ } else {
+ printf("EED WidgetShowNPoints::MovePoint_ BB \n" );
+ if (id>=0) {
+ int i,j,sizeG,sizeP;
+ double max=100000;
+ double minX=max,minY=max,minZ=max;
+ double maxX=-max,maxY=-max,maxZ=-max;
+ sizeG = lstModelShowNPoints.size();
+ for (i=0; i<sizeG; i++)
+ {
+ std::vector<double> lstX = lstModelShowNPoints[i]->GetLstPointsX();
+ std::vector<double> lstY = lstModelShowNPoints[i]->GetLstPointsY();
+ std::vector<double> lstZ = lstModelShowNPoints[i]->GetLstPointsZ();
+ sizeP=lstX.size();
+ for (j=0; j<sizeP; j++)
+ {
+ if ( lstX[j]<minX ) { minX=lstX[j]; }
+ if ( lstY[j]<minY ) { minY=lstY[j]; }
+ if ( lstZ[j]<minZ ) { minZ=lstZ[j]; }
+ if ( lstX[j]>maxX ) { maxX=lstX[j]; }
+ if ( lstY[j]>maxY ) { maxY=lstY[j]; }
+ if ( lstZ[j]>maxZ ) { maxZ=lstZ[j]; }
+ } // for j
+ } // for i
+ double pc[3];
+ pc[0]=(minX+maxX) /2 ; pc[1]=(minY+maxY) /2 ; pc[2]=(minZ+maxZ) /2 ;
+ double p[3];
+ p[0]=GetModelShowNPoints()->GetLstPointsX()[id];
+ p[1]=GetModelShowNPoints()->GetLstPointsY()[id];
+ p[2]=GetModelShowNPoints()->GetLstPointsZ()[id];
+ double v[3];
+ v[0] = p[0]-pc[0];
+ v[1] = p[1]-pc[1];
+ v[2] = p[2]-pc[2];
+ double mag=sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] );
+
+ std::vector<double> point;
+ if (mag!=0)
+ {
+ v[0] = v[0]/mag;
+ v[1] = v[1]/mag;
+ v[2] = v[2]/mag;
+ } else {
+ v[0] = 0;
+ v[1] = 0;
+ v[2] = 0;
+ }// if mag
+ point.push_back( p[0] + step*v[0] );
+ point.push_back( p[1] + step*v[1] );
+ point.push_back( p[2] + step*v[2] );
+ GetModelShowNPoints()->SetPointById(id,point);
+ UndoRedo_SaveCollection();
+
+ } // if id
+
+ } // if aux_mesh
+
+ RefreshCollectionText();
+ RefreshColourCollection();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnMovePointUp(wxCommandEvent& event)
+{
+ MovePoint_(-1);
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnMovePointDown(wxCommandEvent& event)
+{
+ MovePoint_(+1);
+}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::TrackingPoint( )
{
if (idTrack>=0)
{
GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
- GetViewShowNPoints()->RefreshPoint(idTrack);
- GetViewShowNPoints()->Render();
+
+ RefreshCollectionText();
+ RefreshColourCollection();
+
+// GetViewShowNPoints()->RefreshPoint(idTrack);
+// GetViewShowNPoints()->Render();
UndoRedo_SaveCollection();
} // if id
} // if trackPointFlag
idTrack = -1;
if ( cbTrackPoint->GetValue() == true )
{
- idTrack = GetModelShowNPoints()->IdInsidePoint();
+ // EED 2023-06-23
+// idTrack = GetModelShowNPoints()->IdInsidePoint();
+ idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
} // if trackPointFlag
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
{
- printf("WidgetShowNPoints::OnTrackPoint \n");
OnTrackPoint_();
}
}
//------------------------------------------------------------------------
- void WidgetShowNPoints::ErasePoint(int id)
+ bool WidgetShowNPoints::ErasePoint(int id)
{
// EED 2022-05-19
//if (this->renderer!=NULL)
+ bool ok=false;
if (GetViewShowNPoints()->renderer!=NULL)
{
if (id>=0)
//lstSourceSphere.erase( lstSourceSphere.begin()+id );
GetViewShowNPoints()->ErasePoint(id);
GetModelShowNPoints()->ErasePoint(id);
+ ok=true;
} // if id
} // if renderer
+ return ok;
}
//------------------------------------------------------------------------
StopAutoAddPoints();
StopTrackPoint();
- ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
- SetOutputBox();
- // EED 2022-05-19
- //renderer->GetRenderWindow()->Render();
- GetViewShowNPoints()->Render();
- StopTrackPoint();
- UndoRedo_SaveCollection();
+ //ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
+ if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
+ {
+ SetOutputBox();
+ // EED 2022-05-19
+ //renderer->GetRenderWindow()->Render();
+ // GetViewShowNPoints()->Render();
+ RefreshCollectionText();
+ RefreshColourCollection();
+ StopTrackPoint();
+ UndoRedo_SaveCollection();
+ }
}
//------------------------------------------------------------------------
int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
ErasePoint( id );
+
+ RefreshCollectionText();
+ RefreshColourCollection();
+
UndoRedo_SaveCollection();
GetViewShowNPoints()->Render();
SetOutputBox();
void WidgetShowNPoints::CreatePointsIntoNewCollection()
{
// ---------------------------------------------
- printf("\nWidgetShowNPoints::InsertCollection mActualCollection=%d\n",mActualCollection);
- int c1 = mActualCollection-1;
- int c2 = mActualCollection+1;
- if (c2==lstModelShowNPoints.size()) { c2=0; }
- if ((c1>=0) && (c1!=c2) )
+ int c1 = mActualCollection-1;
+ int c2 = mActualCollection+1;
+ int modelSize = lstModelShowNPoints.size();
+ if (aux_mesh_type==2) // SplineClose2
+ {
+ if (c1==-1) { c1=modelSize-1; }
+ if (c2==modelSize) { c2=0; }
+ } // if aux_mesh_type
+
+ if ( (c1!=c2) && (c1>=0) && (c1<modelSize) && (c2>=0) && (c2<modelSize) )
{
std::vector<double> c1LstX = lstModelShowNPoints[c1]->GetLstPointsX();
std::vector<double> c1LstY = lstModelShowNPoints[c1]->GetLstPointsY();
creaContoursFactory f;
manualContourModel *m;
double x,y,z;
- int i,size;
+ int i,ii,size;
int sc; // sizeContour
if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) )
} // for
delete m;
// ----------------- Add new Points --------------------
- i=0; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
-// i=33; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
-// i=66; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
- i=25; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
- i=50; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
- i=75; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
- i=sc-1;x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ vtkPoints *points;
+ vtkStaticPointLocator *pointLocator;
+ if (aux_mesh!=NULL)
+ {
+ points = aux_mesh->GetPoints();
+ pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( aux_mesh );
+ pointLocator->BuildLocator();
+ vtkPoints *points = aux_mesh->GetPoints();
+ vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( aux_mesh );
+ pointLocator->BuildLocator();
+ } // if aux_mesh
+
+ double p[3], pM[3];
+ if ( c1LstX.size()<c2LstX.size() ) { size=c2LstX.size(); } else { size=c1LstX.size(); }
+ for (ii=0;ii<size;ii++)
+ {
+ i = (int) ((double)ii/((double)size-1)*(sc-1));
+ x = (c1LstXX[i]+c2LstXX[i])/2;
+ y = (c1LstYY[i]+c2LstYY[i])/2;
+ z = (c1LstZZ[i]+c2LstZZ[i])/2;
+
+ if (aux_mesh!=NULL)
+ {
+ p[0] = x * aux_mesh_spc[0];
+ p[1] = y * aux_mesh_spc[1];
+ p[2] = z * aux_mesh_spc[2];
+ points->GetPoint( pointLocator->FindClosestPoint(p) , pM );
+// x = pM[0] / aux_mesh_spc[0];
+// y = pM[1] / aux_mesh_spc[1];
+// z = pM[2] / aux_mesh_spc[2];
+ } // aux_mesh
+
+ AddPoint(x,y,z,"");
+ }
+ pointLocator->Delete();
RefreshCollectionText();
RefreshColourCollection();
-
-
} // if size of c1LstX c2LstX
} // if c1 && c2
-
}
-
-
//------------------------------------------------------------------------
void WidgetShowNPoints::DeleteCollection_()
{
{
StopAutoAddPoints();
StopTrackPoint();
-
InvertLstPoints_();
SetOutputBox();
UndoRedo_SaveCollection();
idUndoRedo++;
}
-
+//------------------------------------------------------------------------
+void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector<double> spc, std::vector<double> params)
+{
+ aux_mesh = mesh;
+ aux_mesh_spc = spc;
+ if (params.size()==1)
+ {
+ aux_mesh_type = params[0];
+ } else {
+ aux_mesh_type = 0;
+ }// if params size
+}
#include <wx/stattext.h>
#include <wx/checkbox.h>
+#include "vtkPolyData.h"
+
+
class WidgetShowNPoints : public wxPanel
{
void OnResetCollections_();
void OnResetCollections(wxCommandEvent &event);
void GetCollectionPoint(int idCol,int idPoint, double *pPoint);
-
void SetCollectionPoint(int idCol, int idPoint, std::vector<double> modPoint);
void SetActualCollection( int actual );
-
void OnUndo(wxCommandEvent &event);
void OnRedo(wxCommandEvent &event);
void UndoRedo_SaveCollection();
std::string GetUndoRedoFileName();
+ void MovePoint_(double step);
+ void OnMovePointUp(wxCommandEvent& event);
+ void OnMovePointDown(wxCommandEvent& event);
+
+
void RefreshCollectionText();
void RefreshColourCollection();
ViewShowNPoints* GetViewShowNPoints();
void SetInitLstPoints( std::vector<double> initLstPointsX, std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels, std::vector<int> initLstIndexs );
- void SetType(int type);
- int GetType();
- double GetRadio();
- double GetOpacity();
- virtual void SetOutputBox();
- void ErasePoint(int id);
+ void SetType(int type);
+ int GetType();
+ double GetRadio();
+ double GetOpacity();
+ virtual void SetOutputBox();
+ bool ErasePoint(int id);
- std::vector<double> GetLstPointsX();
- std::vector<double> GetLstPointsY();
- std::vector<double> GetLstPointsZ();
- std::vector<std::string> GetLstLabels();
- std::vector<int> GetLstIndexs();
+ void SetAuxMesh(vtkPolyData* , std::vector<double> spc, std::vector<double> params);
+
+ std::vector<double> GetLstPointsX();
+ std::vector<double> GetLstPointsY();
+ std::vector<double> GetLstPointsZ();
+ std::vector<std::string> GetLstLabels();
+ std::vector<int> GetLstIndexs();
protected:
private:
- std::vector<ViewShowNPoints*> lstViewShowNPoints;
- //NTU: For updating points
- wxStaticText * askPointLabel;
- wxTextCtrl * textCtrl;
- wxStaticText * txtNrCollections;
- wxStaticText * txtNrPoints;
- wxSlider * sdrOpacity;
- wxSlider * sdrRadio;
- wxCheckBox * cbTrackPoint;
- wxCheckBox * cbAutoAddPoints;
-
- std::vector<ModelShowNPoints*> lstModelShowNPoints;
- int mtype;
- int mActualCollection;
- int idTrack;
- int idUndoRedo;
- int maxUndoRedo;
- std::string UndoRedoDir;
+ std::vector<ViewShowNPoints*> lstViewShowNPoints;
+ //NTU: For updating points
+ wxStaticText * askPointLabel;
+ wxTextCtrl * textCtrl;
+ wxStaticText * txtNrCollections;
+ wxStaticText * txtNrPoints;
+ wxSlider * sdrOpacity;
+ wxSlider * sdrRadio;
+ wxCheckBox * cbTrackPoint;
+ wxCheckBox * cbAutoAddPoints;
+
+ std::vector<ModelShowNPoints*> lstModelShowNPoints;
+ int mtype;
+ int mActualCollection;
+ int idTrack;
+ int idUndoRedo;
+ int maxUndoRedo;
+ std::string UndoRedoDir;
+
+ vtkPolyData *aux_mesh;
+ std::vector<double> aux_mesh_spc;
+ int aux_mesh_type;
};
_wxvtk3Dbaseview->Configure();
_wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
// Actors are added to the renderer.
- vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
+
+//EED 2023-06-23
+// vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
+ showOutlineBoxActor(true);
vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New();
_myCallback->SetWxVtkMPR3DView(this);
//EED 27/05/2013
// this->ResetCamera();
_wxvtk3Dbaseview->ResetCamera();
+ showOutlineBoxActor(false);
// Set a background color for the renderer and set the size of the
// render window (expressed in pixels).
_ckBoxOutlineBox = new wxCheckBox(panel,-1,_T("Outline Box"));
- _ckBoxOutlineBox->SetValue(true);
+ _ckBoxOutlineBox->SetValue(false);
_ckBoxOutlinePlane = new wxCheckBox(panel,-1,_T("Outline Plane"));
_ckBoxOutlinePlane->SetValue(true);