src/editmodes/circleMode.cc

changeset 945
c310073e4f22
parent 873
201083693300
child 946
9cbd658b63f9
equal deleted inserted replaced
944:1a6f1997fcbe 945:c310073e4f22
75 LDObjectList objs; 75 LDObjectList objs;
76 const int segments (g_win->ringToolSegments()); 76 const int segments (g_win->ringToolSegments());
77 const int divisions (g_win->ringToolHiRes() ? HighResolution : LowResolution); 77 const int divisions (g_win->ringToolHiRes() ? HighResolution : LowResolution);
78 double dist0 (getCircleDrawDist (0)); 78 double dist0 (getCircleDrawDist (0));
79 double dist1 (getCircleDrawDist (1)); 79 double dist1 (getCircleDrawDist (1));
80 LDDocumentPtr refFile; 80 LDDocument* refFile;
81 Matrix transform; 81 Matrix transform;
82 bool circleOrDisc = false; 82 bool circleOrDisc = false;
83 83
84 if (dist1 < dist0) 84 if (dist1 < dist0)
85 qSwap (dist0, dist1); 85 qSwap (dist0, dist1);
102 { 102 {
103 // The ring finder found a solution, use that. Add the component rings to the file. 103 // The ring finder found a solution, use that. Add the component rings to the file.
104 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) 104 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents())
105 { 105 {
106 refFile = GetPrimitive (::Ring, segments, divisions, cmp.num); 106 refFile = GetPrimitive (::Ring, segments, divisions, cmp.num);
107 LDSubfilePtr ref = LDSpawn<LDSubfile>(); 107 LDSubfile* ref = LDSpawn<LDSubfile>();
108 ref->setFileInfo (refFile); 108 ref->setFileInfo (refFile);
109 ref->setTransform (getCircleDrawMatrix (cmp.scale)); 109 ref->setTransform (getCircleDrawMatrix (cmp.scale));
110 ref->setPosition (m_drawedVerts[0]); 110 ref->setPosition (m_drawedVerts[0]);
111 ref->setColor (MainColor()); 111 ref->setColor (MainColor());
112 objs << ref; 112 objs << ref;
142 v2.setCoordinate (localx, v2[localx] + c1[i].x2()); 142 v2.setCoordinate (localx, v2[localx] + c1[i].x2());
143 v2.setCoordinate (localy, v2[localy] + c1[i].y2()); 143 v2.setCoordinate (localy, v2[localy] + c1[i].y2());
144 v3.setCoordinate (localx, v3[localx] + c1[i].x1()); 144 v3.setCoordinate (localx, v3[localx] + c1[i].x1());
145 v3.setCoordinate (localy, v3[localy] + c1[i].y1()); 145 v3.setCoordinate (localy, v3[localy] + c1[i].y1());
146 146
147 LDQuadPtr quad (LDSpawn<LDQuad> (v0, v1, v2, v3)); 147 LDQuad* quad (LDSpawn<LDQuad> (v0, v1, v2, v3));
148 quad->setColor (MainColor()); 148 quad->setColor (MainColor());
149 149
150 // Ensure the quads always are BFC-front towards the camera 150 // Ensure the quads always are BFC-front towards the camera
151 if (renderer()->camera() % 3 <= 0) 151 if (renderer()->camera() % 3 <= 0)
152 quad->invert(); 152 quad->invert();
155 } 155 }
156 } 156 }
157 157
158 if (circleOrDisc and refFile != null) 158 if (circleOrDisc and refFile != null)
159 { 159 {
160 LDSubfilePtr ref = LDSpawn<LDSubfile>(); 160 LDSubfile* ref = LDSpawn<LDSubfile>();
161 ref->setFileInfo (refFile); 161 ref->setFileInfo (refFile);
162 ref->setTransform (transform); 162 ref->setTransform (transform);
163 ref->setPosition (m_drawedVerts[0]); 163 ref->setPosition (m_drawedVerts[0]);
164 ref->setColor (MainColor()); 164 ref->setColor (MainColor());
165 objs << ref; 165 objs << ref;

mercurial