Tue, 14 May 2013 22:18:38 +0300
Added Isecalc interface
roadmap.txt | file | annotate | diff | comparison | revisions | |
src/extprogs.cpp | file | annotate | diff | comparison | revisions | |
src/extprogs.h | file | annotate | diff | comparison | revisions | |
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions |
--- a/roadmap.txt Tue May 14 18:33:02 2013 +0300 +++ b/roadmap.txt Tue May 14 22:18:38 2013 +0300 @@ -16,6 +16,7 @@ any recompiling and will probably be a lot faster. DONE: + - [Plane draw] Get the thing working for non-top cameras. ----------------------------- -- Alpha 2 @@ -25,7 +26,6 @@ RECOMMENDED: - [Plane draw] Option support: rectangle, line loop, circle, ellipse?, disc - - [Plane draw] Get the thing working for non-top cameras. - [Viewport] Vertex drawing and selection, if possible.. - [Color selector] Rewrite the viewport, don't use QPen for color edges! @@ -36,7 +36,6 @@ -- Stable 1.0 REQUIRED: - - [Plane draw] Get the thing working for non-top cameras. - Anything that crashes the thing has to be obviously fixed. SUGGESTED:
--- a/src/extprogs.cpp Tue May 14 18:33:02 2013 +0300 +++ b/src/extprogs.cpp Tue May 14 22:18:38 2013 +0300 @@ -40,7 +40,6 @@ cfg (str, prog_intersector, ""); cfg (str, prog_coverer, ""); cfg (str, prog_ytruder, ""); -cfg (str, prog_datheader, ""); cfg (str, prog_rectifier, ""); const char* g_extProgNames[] = { @@ -49,7 +48,6 @@ "Coverer", "Ytruder", "Rectifier", - "DATHeader", }; // ============================================================================= @@ -528,4 +526,46 @@ writeColorGroup (in2Col, in2DATName); runUtilityProcess (Coverer, prog_coverer, argv); insertOutput (outDATName, false, {}); +} + +void runIsecalc () { + setlocale (LC_ALL, "C"); + + if (!checkProgPath (prog_isecalc, Isecalc)) + return; + + QDialog dlg; + + LabeledWidget<QComboBox>* cmb_col1 = buildColorSelector ("Shape 1"), + *cmb_col2 = buildColorSelector ("Shape 2"); + + QVBoxLayout* layout = new QVBoxLayout (&dlg); + layout->addWidget (cmb_col1); + layout->addWidget (cmb_col2); + layout->addWidget (makeButtonBox (dlg)); + +exec: + if (!dlg.exec ()) + return; + + const short in1Col = cmb_col1->w ()->itemData (cmb_col1->w ()->currentIndex ()).toInt (), + in2Col = cmb_col1->w ()->itemData (cmb_col2->w ()->currentIndex ()).toInt (); + + if (in1Col == in2Col) { + critical ("Cannot use the same color group for both input and cutter!"); + goto exec; + } + + QTemporaryFile in1dat, in2dat, outdat; + str in1DATName, in2DATName, outDATName; + + if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) + return; + + str argv = fmt ("%s %s %s", in1DATName.c (), in2DATName.c (), outDATName.c ()); + + writeColorGroup (in1Col, in1DATName); + writeColorGroup (in2Col, in2DATName); + runUtilityProcess (Isecalc, prog_isecalc, argv); + insertOutput (outDATName, false, {}); } \ No newline at end of file
--- a/src/extprogs.h Tue May 14 18:33:02 2013 +0300 +++ b/src/extprogs.h Tue May 14 22:18:38 2013 +0300 @@ -27,12 +27,12 @@ Coverer, Ytruder, Rectifier, - DATHeader }; void runYtruder (); void runRectifier (); void runIntersector (); void runCoverer (); +void runIsecalc (); #endif // EXTPROGS_H \ No newline at end of file
--- a/src/gui.cpp Tue May 14 18:33:02 2013 +0300 +++ b/src/gui.cpp Tue May 14 22:18:38 2013 +0300 @@ -246,6 +246,7 @@ addMenuAction ("ytruder"); addMenuAction ("rectifier"); addMenuAction ("intersector"); + addMenuAction ("isecalc"); addMenuAction ("coverer"); // Help menu @@ -395,6 +396,7 @@ addToolBarAction ("ytruder"); addToolBarAction ("rectifier"); addToolBarAction ("intersector"); + addToolBarAction ("isecalc"); addToolBarAction ("coverer"); updateToolBars (); }
--- a/src/gui_editactions.cpp Tue May 14 18:33:02 2013 +0300 +++ b/src/gui_editactions.cpp Tue May 14 22:18:38 2013 +0300 @@ -684,6 +684,10 @@ runCoverer (); } +MAKE_ACTION (isecalc, "Isecalc", "isecalc", "Compute intersection between objects", (0)) { + runIsecalc (); +} + // ========================================================================================================================================= MAKE_ACTION (replaceCoords, "Replace Coordinates", "replace-coords", "Find and replace coordinate values", CTRL (R)) { ReplaceCoordsDialog dlg;