From 5ca8911a683f814a437f482dda75c1cf8e7d7e79 Mon Sep 17 00:00:00 2001 From: JacobStoren Date: Mon, 9 Dec 2013 15:48:55 +0100 Subject: [PATCH] Linux compile fixes --- .../RivCellFaceIntersection-Test.cpp | 53 +++++++++---------- .../ModelVisualization/cvfGeometryTools.cpp | 2 +- .../ModelVisualization/cvfGeometryTools.h | 3 +- .../ModelVisualization/cvfGeometryTools.inl | 50 ++++++++--------- Fwk/VizFwk/LibCore/cvfArrayWrapperConst.h | 2 +- Fwk/VizFwk/LibCore/cvfArrayWrapperToEdit.h | 2 +- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivCellFaceIntersection-Test.cpp b/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivCellFaceIntersection-Test.cpp index fe4f1e43bd..0666ddeea4 100644 --- a/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivCellFaceIntersection-Test.cpp +++ b/ApplicationCode/ModelVisualization/ModelVisualization_UnitTests/RivCellFaceIntersection-Test.cpp @@ -29,7 +29,6 @@ #include "cvfGeometryTools.h" #include "cvfBoundingBoxTree.h" -#include using namespace cvf; @@ -192,7 +191,7 @@ std::vector getCubeFaces() return cubeFaces; } -std::ostream& operator<< (std::ostream& stream, std::vector v) +std::ostream& operator<< (std::ostream& stream, std::vector v) { for (size_t i = 0; i < v.size(); ++i) { @@ -210,13 +209,13 @@ TEST(CellFaceIntersectionTst, Intersection1) std::vector additionalVertices; - std::vector< std::vector > overlapPolygons; + std::vector< std::vector > overlapPolygons; std::vector faces = getCubeFaces(); - EdgeIntersectStorage edgeIntersectionStorage; + EdgeIntersectStorage edgeIntersectionStorage; edgeIntersectionStorage.setVertexCount(nodes.size()); { - std::vector polygon; + std::vector polygon; bool isOk = false; isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon, @@ -227,7 +226,7 @@ TEST(CellFaceIntersectionTst, Intersection1) faces[1].data(), 1e-6); - EXPECT_EQ( 5, polygon.size()); + EXPECT_EQ( (size_t)5, polygon.size()); EXPECT_EQ( (size_t)2, additionalVertices.size()); EXPECT_TRUE(isOk); overlapPolygons.push_back(polygon); @@ -236,7 +235,7 @@ TEST(CellFaceIntersectionTst, Intersection1) } { - std::vector polygon; + std::vector polygon; bool isOk = false; isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon, @@ -247,7 +246,7 @@ TEST(CellFaceIntersectionTst, Intersection1) faces[2].data(), 1e-6); - EXPECT_EQ( 5, polygon.size()); + EXPECT_EQ( (size_t)5, polygon.size()); EXPECT_EQ( (size_t)4, additionalVertices.size()); EXPECT_TRUE(isOk); overlapPolygons.push_back(polygon); @@ -256,7 +255,7 @@ TEST(CellFaceIntersectionTst, Intersection1) } { - std::vector polygon; + std::vector polygon; bool isOk = false; isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon, @@ -267,7 +266,7 @@ TEST(CellFaceIntersectionTst, Intersection1) faces[3].data(), 1e-6); - EXPECT_EQ( 3, polygon.size()); + EXPECT_EQ( (size_t)3, polygon.size()); EXPECT_EQ( (size_t)6, additionalVertices.size()); EXPECT_TRUE(isOk); overlapPolygons.push_back(polygon); @@ -275,10 +274,10 @@ TEST(CellFaceIntersectionTst, Intersection1) } nodes.insert(nodes.end(), additionalVertices.begin(), additionalVertices.end()); - std::vector basePolygon; + std::vector basePolygon; basePolygon.insert(basePolygon.begin(), faces[0].data(), &(faces[0].data()[4])); - for (uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx) + for (cvf::uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx) { bool inserted = GeometryTools::insertVertexInPolygon( &basePolygon, @@ -288,12 +287,12 @@ TEST(CellFaceIntersectionTst, Intersection1) ); } - EXPECT_EQ( 8, basePolygon.size()); + EXPECT_EQ( (size_t)8, basePolygon.size()); std::cout << "Bp: " << basePolygon << std::endl; for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx) { - for (uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx) + for (cvf::uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx) { bool inserted = GeometryTools::insertVertexInPolygon( &overlapPolygons[pIdx], @@ -305,15 +304,15 @@ TEST(CellFaceIntersectionTst, Intersection1) if (pIdx == 0) { - EXPECT_EQ(5, overlapPolygons[pIdx].size()); + EXPECT_EQ((size_t)5, overlapPolygons[pIdx].size()); } if (pIdx == 1) { - EXPECT_EQ(5, overlapPolygons[pIdx].size()); + EXPECT_EQ((size_t)5, overlapPolygons[pIdx].size()); } if (pIdx == 2) { - EXPECT_EQ(4, overlapPolygons[pIdx].size()); + EXPECT_EQ((size_t)4, overlapPolygons[pIdx].size()); } std::cout << "Op" << pIdx << ":" << overlapPolygons[pIdx] << std::endl; @@ -325,10 +324,10 @@ TEST(CellFaceIntersectionTst, Intersection1) faceOverlapPolygonWindingSameAsCubeFaceFlags.resize(overlapPolygons.size(), true); { - std::vector freeFacePolygon; + std::vector freeFacePolygon; bool hasHoles = false; - std::vector< std::vector* > overlapPolygonPtrs; + std::vector< std::vector* > overlapPolygonPtrs; for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx) { overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx])); @@ -344,16 +343,16 @@ TEST(CellFaceIntersectionTst, Intersection1) &hasHoles ); - EXPECT_EQ( 4, freeFacePolygon.size()); + EXPECT_EQ( (size_t)4, freeFacePolygon.size()); EXPECT_FALSE(hasHoles); std::cout << "FF1: " << freeFacePolygon << std::endl; } { - std::vector freeFacePolygon; + std::vector freeFacePolygon; bool hasHoles = false; - std::vector< std::vector* > overlapPolygonPtrs; + std::vector< std::vector* > overlapPolygonPtrs; for (size_t pIdx = 0; pIdx < 1; ++pIdx) { overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx])); @@ -369,7 +368,7 @@ TEST(CellFaceIntersectionTst, Intersection1) &hasHoles ); - EXPECT_EQ( 9, freeFacePolygon.size()); + EXPECT_EQ( (size_t)9, freeFacePolygon.size()); EXPECT_FALSE(hasHoles); std::cout << "FF2: " << freeFacePolygon << std::endl; @@ -414,7 +413,7 @@ TEST(CellFaceIntersectionTst, Intersection) bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage, wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6); - EXPECT_EQ( 4, polygon.size()); + EXPECT_EQ( (size_t)4, polygon.size()); EXPECT_EQ( (size_t)0, additionalVertices.size()); EXPECT_TRUE(isOk); @@ -432,7 +431,7 @@ TEST(CellFaceIntersectionTst, Intersection) isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage, wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6); - EXPECT_EQ( 8, polygon.size()); + EXPECT_EQ( (size_t)8, polygon.size()); EXPECT_EQ( (size_t)8, additionalVertices.size()); EXPECT_TRUE(isOk); @@ -475,7 +474,7 @@ TEST(CellFaceIntersectionTst, FreeFacePolygon) bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage, wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6); - EXPECT_EQ( 4, polygon.size()); + EXPECT_EQ( (size_t)4, polygon.size()); EXPECT_EQ( (size_t)0, additionalVertices.size()); EXPECT_TRUE(isOk); @@ -509,7 +508,7 @@ TEST(CellFaceIntersectionTst, FreeFacePolygon) isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage, wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6); - EXPECT_EQ( 8, polygon.size()); + EXPECT_EQ( (size_t)8, polygon.size()); EXPECT_EQ( (size_t)8, additionalVertices.size()); EXPECT_TRUE(isOk); diff --git a/ApplicationCode/ModelVisualization/cvfGeometryTools.cpp b/ApplicationCode/ModelVisualization/cvfGeometryTools.cpp index fbb10bae85..ad850323c6 100644 --- a/ApplicationCode/ModelVisualization/cvfGeometryTools.cpp +++ b/ApplicationCode/ModelVisualization/cvfGeometryTools.cpp @@ -922,4 +922,4 @@ bool FanEarClipTesselator::isTriangleValid(size_t u, size_t v, size_t w) } -} \ No newline at end of file +} diff --git a/ApplicationCode/ModelVisualization/cvfGeometryTools.h b/ApplicationCode/ModelVisualization/cvfGeometryTools.h index ca57e7101a..1d2962859c 100644 --- a/ApplicationCode/ModelVisualization/cvfGeometryTools.h +++ b/ApplicationCode/ModelVisualization/cvfGeometryTools.h @@ -3,7 +3,6 @@ #include "cvfArray.h" #include #include -#include #include "cvfArrayWrapperConst.h" namespace cvf @@ -165,4 +164,4 @@ private: } -#include "cvfGeometryTools.inl" \ No newline at end of file +#include "cvfGeometryTools.inl" diff --git a/ApplicationCode/ModelVisualization/cvfGeometryTools.inl b/ApplicationCode/ModelVisualization/cvfGeometryTools.inl index c28b1f928b..0cbda7cb72 100644 --- a/ApplicationCode/ModelVisualization/cvfGeometryTools.inl +++ b/ApplicationCode/ModelVisualization/cvfGeometryTools.inl @@ -1,3 +1,5 @@ +#include + #pragma warning (disable : 4503) namespace cvf @@ -22,7 +24,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector * polygon, // Check if vertex is directly included already - for(std::vector::iterator it = polygon->begin(); it != polygon->end(); ++it) + for(typename std::vector::iterator it = polygon->begin(); it != polygon->end(); ++it) { if (*it == vertexIndex) return true; } @@ -31,7 +33,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector * polygon, // Check if the new point is within tolerance of one of the polygon vertices bool existsOrInserted = false; - for(std::vector::iterator it = polygon->begin(); it != polygon->end(); ++it) + for(typename std::vector::iterator it = polygon->begin(); it != polygon->end(); ++it) { if ( (nodeCoords[*it] - nodeCoords[vertexIndex]).length() < tolerance) { @@ -54,10 +56,10 @@ bool GeometryTools::insertVertexInPolygon( std::vector * polygon, // Insert vertex in polygon if the distance to one of the edges is small enough - std::list::iterator it2; - std::list::iterator insertBefore; + typename std::list::iterator it2; + typename std::list::iterator insertBefore; - for (std::list::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it) + for (typename std::list::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it) { it2 = it; ++it2; insertBefore = it2; if (it2 == listPolygon.end()) it2 = listPolygon.begin(); @@ -73,7 +75,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector * polygon, // Write polygon back into the vector polygon->clear(); - for (std::list::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it) + for (typename std::list::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it) { polygon->push_back(*it); } @@ -472,7 +474,7 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector * p sortingMap[intersectionFractionsAlongEdge[i]] = intersectionVxIndices[i]; } - std::map::iterator it; + typename std::map::iterator it; for (it = sortingMap.begin(); it != sortingMap.end(); ++it) { if (polygon->empty() || polygon->back() != it->second) @@ -557,7 +559,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::const_iterator > VxIdxToPolygonPositionMap; + typedef std::map< IndexType, typename std::vector::const_iterator > VxIdxToPolygonPositionMap; CVF_ASSERT(m_partiallyFreeCubeFaceHasHoles); CVF_ASSERT(partialFacePolygon != NULL); @@ -584,7 +586,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::const_iterator pcIt = faceOverlapPolygons[i]->begin(); + for (typename std::vector::const_iterator pcIt = faceOverlapPolygons[i]->begin(); pcIt != faceOverlapPolygons[i]->end(); ++pcIt) { @@ -637,19 +639,19 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt) + for (typename std::list::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt) { // Set iterator to previous node in polygon - std::list::iterator prevPIt = pIt; + typename std::list::iterator prevPIt = pIt; if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end(); --prevPIt; cvf::Vec3d pToPrev = nodeCoords[*prevPIt] - nodeCoords[*pIt]; // Set iterator to next node in polygon. Used to insert before and as pointer to the next point - std::list::iterator nextPIt = pIt; + typename std::list::iterator nextPIt = pIt; ++nextPIt; - std::list::iterator insertBeforePIt = nextPIt; + typename std::list::iterator insertBeforePIt = nextPIt; if (nextPIt == resultPolygon.end()) nextPIt = resultPolygon.begin(); // Calculate existing edge to edge angle @@ -664,14 +666,14 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::const_iterator startCPIt; + typename std::vector::const_iterator startCPIt; startCPIt = vxIndexPositionInPolygonIt->second; // First vx to insert is the one after the match @@ -696,7 +698,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::const_iterator pcIt = startCPIt; + typename std::vector::const_iterator pcIt = startCPIt; if (hasSameWinding) { do @@ -740,10 +742,10 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end() && !goneAround; ++pIt) + for ( typename std::list::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end() && !goneAround; ++pIt) { // Set iterator to next node in polygon. - std::list::iterator nextPIt = pIt; + typename std::list::iterator nextPIt = pIt; ++nextPIt; if (nextPIt == resultPolygon.end()) { @@ -753,7 +755,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst::iterator prevPIt = pIt; + typename std::list::iterator prevPIt = pIt; if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end(); --prevPIt; @@ -812,7 +814,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConstclear(); - for (std::list::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt) + for (typename std::list::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt) { partialFacePolygon->push_back(*pIt); } @@ -914,15 +916,15 @@ bool EdgeIntersectStorage::findIntersection(IndexType e1P1, IndexType if (!m_edgeIntsectMap[e1P1].size()) return false; - std::map > >::iterator it; + typename std::map > >::iterator it; it = m_edgeIntsectMap[e1P1].find(e1P2); if (it == m_edgeIntsectMap[e1P1].end()) return false; - std::map >::iterator it2; + typename std::map >::iterator it2; it2 = it->second.find(e2P1); if (it2 == it->second.end()) return false; - std::map::iterator it3; + typename std::map::iterator it3; it3 = it2->second.find(e2P2); if (it3 == it2->second.end()) return false; @@ -948,4 +950,4 @@ bool EdgeIntersectStorage::findIntersection(IndexType e1P1, IndexType -} \ No newline at end of file +} diff --git a/Fwk/VizFwk/LibCore/cvfArrayWrapperConst.h b/Fwk/VizFwk/LibCore/cvfArrayWrapperConst.h index 745f57685b..88049066b0 100644 --- a/Fwk/VizFwk/LibCore/cvfArrayWrapperConst.h +++ b/Fwk/VizFwk/LibCore/cvfArrayWrapperConst.h @@ -150,4 +150,4 @@ inline const ArrayWrapperConst< const ElmType*, ElmType > wrapArrayConst( ElmTy return warr; } -} \ No newline at end of file +} diff --git a/Fwk/VizFwk/LibCore/cvfArrayWrapperToEdit.h b/Fwk/VizFwk/LibCore/cvfArrayWrapperToEdit.h index 95929eed46..4ac8558734 100644 --- a/Fwk/VizFwk/LibCore/cvfArrayWrapperToEdit.h +++ b/Fwk/VizFwk/LibCore/cvfArrayWrapperToEdit.h @@ -129,4 +129,4 @@ inline ArrayWrapperToEdit< ElmType*, ElmType > wrapArrayToEdit(ElmType* array, s return warr; } -} \ No newline at end of file +}