Mercurial > hg > orthanc-stone
diff OrthancStone/UnitTestsSources/ComputationalGeometryTests.cpp @ 2161:e65fe2e50fde dicom-sr tip
integration mainline->dicom-sr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Sep 2024 22:34:17 +0200 |
parents | 340bde744884 |
children |
line wrap: on
line diff
--- a/OrthancStone/UnitTestsSources/ComputationalGeometryTests.cpp Sat Aug 31 08:40:01 2024 +0200 +++ b/OrthancStone/UnitTestsSources/ComputationalGeometryTests.cpp Fri Sep 27 22:34:17 2024 +0200 @@ -540,71 +540,6 @@ } -#if 0 -static void SaveSvg(const std::list< std::vector<OrthancStone::ScenePoint2D> >& contours) -{ - float ww = 15; - float hh = 13; - - FILE* fp = fopen("test.svg", "w"); - fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"); - fprintf(fp, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); - fprintf(fp, "<svg width=\"%f\" height=\"%f\" viewBox=\"0 0 %f %f\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", 100.0f*ww, 100.0f*hh, ww, hh); - - // http://thenewcode.com/1068/Making-Arrows-in-SVG - fprintf(fp, "<defs>\n"); - fprintf(fp, "<marker id=\"arrowhead\" markerWidth=\"2\" markerHeight=\"3\" \n"); - fprintf(fp, "refX=\"2\" refY=\"1.5\" orient=\"auto\">\n"); - fprintf(fp, "<polygon points=\"0 0, 2 1.5, 0 3\" />\n"); - fprintf(fp, "</marker>\n"); - fprintf(fp, "</defs>\n"); - - fprintf(fp, "<rect fill=\"#fff\" stroke=\"#000\" x=\"0\" y=\"0\" width=\"%f\" height=\"%f\"/>\n", ww, hh); - - unsigned int count = 0; - - for (std::list< std::vector<OrthancStone::ScenePoint2D> >::const_iterator - it = contours.begin(); it != contours.end(); ++it, count++) - { - std::string color; - if (count == 0) - { - color = "blue"; - } - else if (count == 1) - { - color = "red"; - } - else if (count == 2) - { - color = "green"; - } - else if (count == 3) - { - color = "orange"; - } - else - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); - } - - for (size_t i = 0; i + 1 < it->size(); i++) - { - float x1 = (*it)[i].GetX(); - float x2 = (*it)[i + 1].GetX(); - float y1 = (*it)[i].GetY(); - float y2 = (*it)[i + 1].GetY(); - - fprintf(fp, "<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" stroke=\"%s\" stroke-width=\"0.05\" marker-end=\"url(#arrowhead)\"/>\n", x1, y1, x2, y2, color.c_str()); - } - } - fprintf(fp, "</svg>\n"); - - fclose(fp); -} -#endif - - TEST(UnionOfRectangles, EdgeCases) { {