Anonymous avatar Anonymous committed 69de022

fixed for geos svn

Comments (0)

Files changed (4)

 # Link the executable to the OssimVector library.
 TARGET_LINK_LIBRARIES (ossimVector ${GDAL_LIBRARY} ${GEOS_LIBRARY} ${OSSIM_LIBRARIES} ${GD_LIBRARIES}) 
 
-ADD_EXECUTABLE(ossimVector_cli main.cpp)
-TARGET_LINK_LIBRARIES(ossimVector_cli ossimVector)
+ADD_EXECUTABLE(ossimVector_cl main.cpp)
+TARGET_LINK_LIBRARIES(ossimVector_cl ossimVector)
 
 #include <stdio.h>
 #include "ossimVector.h"
 
+#include <iostream>
 
 int main(int argc, char *argv[])
 {
    gdImagePtr img=NULL;
    char* shpname;
-
    FILE *outfile;
-
-   if(argc < 2) 
+   double minx,miny,maxx,maxy;
+   if(argc < 8) 
    {
-      printf("Usage ./ossimVector_cl [vector_file] [attribute_index] [image_file]\n");
-      printf("eg: ./ossimVector_cl /home/rashad/maps/andhra.shp 6 vector.png\n\n");
+      printf("Usage ./ossimVector_cl [vector_file] [attribute_index] [image_file] [minx] [miny] [maxx] [maxy]\n");
+      printf("eg: ./ossimVector_cl /home/rashad/maps/ernakulam.shp 6 vector.png 76.1683 9.78852 76.8405 10.3018\n\n");
       exit(1);
    }
 
    shpname = argv[1];
    int label_index = strtod(argv[2],NULL);
-   outfile = fopen(argv[7],"wb");
-double minx,miny,maxx,maxy;
+   outfile = fopen(argv[3],"wb");
 
-   minx = strtod(argv[3],NULL);
-   miny = strtod(argv[4],NULL);
-   maxx = strtod(argv[5],NULL);
-   maxy = strtod(argv[6],NULL);
+   minx = strtod(argv[4],NULL);
+   miny = strtod(argv[5],NULL);
+   maxx = strtod(argv[6],NULL);
+   maxy = strtod(argv[7],NULL);
 
-ossimVectorRect *rect;
+
+ossimVectorRect *rect = new ossimVectorRect();
 rect->minx = minx;
 rect->miny = miny;
 rect->maxx = maxx;
 rect->maxy = maxy;
+std::cout << minx << "::" <<miny << "::" << maxx << "::" << maxy << std::endl;
 
    img = renderVector(shpname,label_index,rect);
    gdImagePng(img,outfile);

ossimGdVectorSource.cpp

       	gdImagePolygon(img, gdPoints, size, pencolor);
          break;
 
-
-
-
-
    }
 
    unsigned char* label = (unsigned char*)feature->getLabel().c_str();
-  
    feature->labelPoint.x =OV_MAP2IMAGE_X(feature->labelPoint.x, extent.minx, cellsize);
    feature->labelPoint.y =OV_MAP2IMAGE_Y(feature->labelPoint.y, extent.maxy, cellsize);
    gdImageString(img, gdFontSmall, feature->labelPoint.x, feature->labelPoint.y, label, labelcolor);

ossimVectorSource.cpp

    {
 
       feature->type = FEATURE_POLYGON;
-      geos::geom::Polygon *poPoly = (geos::geom::Polygon *)geom;
+
+      geos::geom::Polygon *poPoly = dynamic_cast<geos::geom::Polygon*>(geom); 
       const geos::geom::LineString *poRing;
 
       poRing = poPoly->getExteriorRing();
    {
 
       feature->type = FEATURE_LINE;
-      geos::geom::LineString *poLine = (geos::geom::LineString *)geom;
+
+      geos::geom::LineString *poLine =  dynamic_cast<geos::geom::LineString*>(geom); 
       int numpoints;
 
       if ((numpoints = poLine->getNumPoints()) < 2)
    {
 
       feature->type = FEATURE_POINT;
-      geos::geom::Point *gpoint = (geos::geom::Point *)geom;
+      geos::geom::Point *gpoint = dynamic_cast<geos::geom::Point*>(geom); 
 
      
        std::vector<ossimVectorPoint>points;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.