src/editmodes/abstractEditMode.cpp

changeset 1063
1f15c52c11f6
parent 1056
27b7991b3bea
child 1064
4c7a353cf583
--- a/src/editmodes/abstractEditMode.cpp	Sat Jan 28 13:49:09 2017 +0200
+++ b/src/editmodes/abstractEditMode.cpp	Sat Jan 28 14:01:19 2017 +0200
@@ -95,7 +95,7 @@
 	if (Super::mouseReleased(data))
 		return true;
 
-	if ((data.releasedButtons & Qt::MidButton) and (m_drawedVerts.size() < 4) and (not data.mouseMoved))
+	if ((data.releasedButtons & Qt::MidButton) and (length(m_drawedVerts) < 4) and (not data.mouseMoved))
 	{
 		// Find the closest vertex to our cursor
 		double minimumDistance = 1024.0;
@@ -155,7 +155,7 @@
 
 	if (data.releasedButtons & Qt::LeftButton)
 	{
-		if (maxVertices() and m_drawedVerts.size() >= maxVertices())
+		if (maxVertices() and length(m_drawedVerts) >= maxVertices())
 			endDraw();
 		else
 			addDrawnVertex (getCursorVertex());
@@ -169,7 +169,7 @@
 {
 	int pos = m_window->suggestInsertPoint();
 
-	if (objs.size() > 0)
+	if (length(objs) > 0)
 	{
 		for (LDObject* obj : objs)
 		{
@@ -198,11 +198,11 @@
 void AbstractDrawMode::renderPolygon(QPainter& painter, const QVector<Vertex>& polygon3d,
 	bool drawLineLengths, bool drawAngles ) const
 {
-	QVector<QPoint> polygon2d (polygon3d.size());
+	QVector<QPoint> polygon2d (length(polygon3d));
 	QFontMetrics metrics = QFontMetrics(QFont());
 
 	// Convert to 2D
-	for (int i = 0; i < polygon3d.size(); ++i)
+	for (int i = 0; i < length(polygon3d); ++i)
 		polygon2d[i] = renderer()->convert3dTo2d(polygon3d[i]);
 
 	// Draw the polygon-to-be
@@ -210,21 +210,21 @@
 	painter.drawPolygon(QPolygonF{polygon2d});
 
 	// Draw vertex blips
-	for (int i = 0; i < polygon3d.size(); ++i)
+	for (int i = 0; i < length(polygon3d); ++i)
 	{
 		renderer()->drawPoint(painter, polygon2d[i]);
 		renderer()->drawBlipCoordinates(painter, polygon3d[i], polygon2d[i]);
 	}
 
 	// Draw line lenghts and angle info if appropriate
-	if (polygon3d.size() >= 2 and (drawLineLengths or drawAngles))
+	if (length(polygon3d) >= 2 and (drawLineLengths or drawAngles))
 	{
 		painter.setPen (renderer()->textPen());
 
-		for (int i = 0; i < polygon3d.size(); ++i)
+		for (int i = 0; i < length(polygon3d); ++i)
 		{
-			int j = (i + 1) % polygon3d.size();
-			int prior = (i - 1 >= 0) ? (i - 1) : (polygon3d.size() - 1);
+			int j = (i + 1) % length(polygon3d);
+			int prior = (i - 1 >= 0) ? (i - 1) : (length(polygon3d) - 1);
 
 			if (drawLineLengths)
 				drawLineLength(painter, polygon3d[i], polygon3d[j], polygon2d[i], polygon2d[j]);

mercurial