[GRASS-SVN] r30173 - in grass/trunk/gui/wxpython: . vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 15 17:04:11 EST 2008


Author: martinl
Date: 2008-02-15 17:04:11 -0500 (Fri, 15 Feb 2008)
New Revision: 30173

Added:
   grass/trunk/gui/wxpython/vdigit/Makefile
Removed:
   grass/trunk/gui/wxpython/vdigit/Makefile.in
Modified:
   grass/trunk/gui/wxpython/Makefile
   grass/trunk/gui/wxpython/vdigit/cats.cpp
   grass/trunk/gui/wxpython/vdigit/driver.cpp
   grass/trunk/gui/wxpython/vdigit/line.cpp
Log:
wxGUI/vdigit: * Makefile template removed
* fix compiler warnings
* compile vdigit if configured --with-wxwidgets


Modified: grass/trunk/gui/wxpython/Makefile
===================================================================
--- grass/trunk/gui/wxpython/Makefile	2008-02-15 21:44:24 UTC (rev 30172)
+++ grass/trunk/gui/wxpython/Makefile	2008-02-15 22:04:11 UTC (rev 30173)
@@ -1,11 +1,17 @@
 MODULE_TOPDIR = ../..
 
-# SUBDIRS=vdigit docs
 SUBDIRS = docs
-ETCDIR = $(ETC)/wxpython
 
+include $(MODULE_TOPDIR)/include/Make/Platform.make
+
+ifneq ($(USE_WXWIDGETS),)
+  SUBDIRS += vdigit
+endif
+
 include $(MODULE_TOPDIR)/include/Make/Dir.make
 
+ETCDIR = $(ETC)/wxpython
+
 default: parsubdirs install_scripts
 
 install_scripts:
@@ -17,8 +23,6 @@
 	$(INSTALL_DATA) images/* $(ETCDIR)/images/
 	$(INSTALL_DATA) scripts/* $(ETCDIR)/scripts/
 	$(INSTALL_DATA) gis_set.py wxgui.py README $(ETCDIR)/
-#	$(INSTALL_DATA) vdigit/_grass6_wxvdigit.so $(ETCDIR)/vdigit/
-#	$(INSTALL_DATA) vdigit/grass6_wxvdigit.py $(ETCDIR)/vdigit/
 	$(INSTALL) -m 755 wxgui $(ETCDIR)/scripts/
 
 clean: cleansubdirs

Copied: grass/trunk/gui/wxpython/vdigit/Makefile (from rev 30165, grass/trunk/gui/wxpython/vdigit/Makefile.in)
===================================================================
--- grass/trunk/gui/wxpython/vdigit/Makefile	                        (rev 0)
+++ grass/trunk/gui/wxpython/vdigit/Makefile	2008-02-15 22:04:11 UTC (rev 30173)
@@ -0,0 +1,43 @@
+MODULE_TOPDIR = ../../..
+
+include $(MODULE_TOPDIR)/include/Make/Platform.make
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+
+SWIG = swig
+
+CXXFLAGS = -c -fpic -I$(ARCH_DISTDIR)/include $(GDALCFLAGS) $(PYTHONCFLAGS) $(WXWIDGETSCXXFLAGS)
+
+LDFLAGS = -shared -fpic -L$(ARCH_LIBDIR) $(VECTLIB) $(GISLIB) $(GDALLIBS) $(VEDITLIB) $(WXWIDGETSLIB) -lgdi 
+
+LOCAL_HEADERS = digit.h driver.h
+SOURCES = driver.cpp digit.cpp cats.cpp line.cpp vertex.cpp select.cpp grass6_wxvdigit_wrap.cpp
+
+OBJARCH = OBJ.$(ARCH)
+OBJ := $(patsubst %.cpp, $(OBJARCH)/%.o, $(SOURCES))
+
+ETCDIR = $(ETC)/wxpython
+
+default: grass6_wxvdigit.so install_vdigit
+
+clean:
+	-rm -rf $(OBJARCH) _grass6_wxvdigit.so grass6_wxvdigit.i	 
+
+grass6_wxvdigit.i:
+	cat ./digit.i > grass6_wxvdigit.i
+	cat ./dig_types.i >> grass6_wxvdigit.i
+	echo "/* auto-generate swig typedef file */" >> grass6_wxvdigit.i
+	cat ./driver.h >> grass6_wxvdigit.i
+	cat ./digit.h >> grass6_wxvdigit.i
+
+create_wrap.cpp: grass6_wxvdigit.i
+	$(SWIG) -c++ -python -shadow -o $@ $<
+
+$(OBJARCH)/%.o: %.cpp $(LOCAL_HEADERS)
+	$(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) $< -o $@
+
+grass6_wxvdigit.so: $(OBJ)
+	$(CXX) $(LDFLAGS) $(OBJ) -o _grass6_wxvdigit.so
+
+install_vdigit:
+	$(INSTALL_DATA) _grass6_wxvdigit.so $(ETCDIR)/vdigit/
+	$(INSTALL_DATA) grass6_wxvdigit.py $(ETCDIR)/vdigit/

Deleted: grass/trunk/gui/wxpython/vdigit/Makefile.in
===================================================================
--- grass/trunk/gui/wxpython/vdigit/Makefile.in	2008-02-15 21:44:24 UTC (rev 30172)
+++ grass/trunk/gui/wxpython/vdigit/Makefile.in	2008-02-15 22:04:11 UTC (rev 30173)
@@ -1,44 +0,0 @@
-### DEFINITIONS
-
-PYTHONVERSION=@PYVERSION@
-
-### END DEFINITIONS
-
-MODULE_TOPDIR = ../../..
-
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
-SWIG=swig
-
-WXCXXFLAGS := $(shell wx-config --cxxflags)
-CXXFLAGS = -c -fpic -I$(ARCH_DISTDIR)/include -I/usr/include/python$(PYTHONVERSION) $(GDALCFLAGS) $(WXCXXFLAGS)
-
-WXLDFLAGS := $(shell wx-config --libs)
-LDFLAGS=-shared -fpic -L$(ARCH_LIBDIR) $(VECTLIB) $(GISLIB) $(GDALLIBS) $(VEDITLIB) -lgdi $(WXLDFLAGS)
-
-LOCAL_HEADERS=digit.h driver.h
-SOURCES=driver.cpp digit.cpp cats.cpp line.cpp vertex.cpp select.cpp grass6_wxvdigit_wrap.cpp
-
-OBJARCH=OBJ.$(ARCH)
-OBJ := $(patsubst %.cpp, $(OBJARCH)/%.o, $(SOURCES))
-
-default: grass6_wxvdigit.so
-
-clean:
-	-rm -rf $(OBJARCH) _grass6_wxvdigit.so grass6_wxvdigit.i	 
-
-grass6_wxvdigit.i:
-	cat ./digit.i > grass6_wxvdigit.i
-	cat ./dig_types.i >> grass6_wxvdigit.i
-	echo "/* auto-generate swig typedef file */" >> grass6_wxvdigit.i
-	cat ./driver.h >> grass6_wxvdigit.i
-	cat ./digit.h >> grass6_wxvdigit.i
-
-grass6_wxvdigit_wrap.cpp: grass6_wxvdigit.i
-	$(SWIG) -c++ -python -shadow -o $@ $<
-
-$(OBJARCH)/%.o: %.cpp $(LOCAL_HEADERS)
-	$(CXX) $(CXXFLAGS) $(INCLUDE_DIRS) $< -o $@
-
-grass6_wxvdigit.so: $(OBJ)
-	$(CXX) $(LDFLAGS) $(OBJ) -o _grass6_wxvdigit.so

Modified: grass/trunk/gui/wxpython/vdigit/cats.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/cats.cpp	2008-02-15 21:44:24 UTC (rev 30172)
+++ grass/trunk/gui/wxpython/vdigit/cats.cpp	2008-02-15 22:04:11 UTC (rev 30173)
@@ -25,7 +25,7 @@
 */
 int Digit::InitCats()
 {
-    int ndblinks, nfields, field, ncats, max_cat;
+    int ndblinks, nfields, field, ncats;
     int cat, type, id; 
 
     struct field_info *fi;
@@ -162,6 +162,7 @@
 	return lc;
     }
 
+    line = -1;
     if (line_id == -1) {
 	line = display->selected->value[0];
     }
@@ -222,6 +223,7 @@
 	return -1;
     }
     
+    line = -1;
     if (line_id == -1) {
 	line = display->selected->value[0];
     }

Modified: grass/trunk/gui/wxpython/vdigit/driver.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver.cpp	2008-02-15 21:44:24 UTC (rev 30172)
+++ grass/trunk/gui/wxpython/vdigit/driver.cpp	2008-02-15 22:04:11 UTC (rev 30173)
@@ -114,7 +114,6 @@
     G_debug(3, "wxDriver.DrawMap(): region: w=%f, e=%f, s=%f, n=%f",
 	    region.box.W, region.box.E, region.box.S, region.box.N);
 
-    bool inBox;
     dc->BeginDrawing();
     for (int i = 0; i < listLines->n_values; i++) {
 	DrawLine(listLines->value[i]);
@@ -147,6 +146,9 @@
 
     wxPen *pen;
 
+    pen = NULL;
+    draw = false;
+
     // read line
     type = Vect_read_line (mapInfo, points, cats, line);
 
@@ -243,7 +245,7 @@
 	    // long int startId = ids[line].startId + 1;
 	    if (dcId > 0 && drawSegments) {
 		dcId = 2; // first segment
-		for (int i = 0; i < pointsScreen->GetCount() - 1; dcId += 2) {
+		for (size_t i = 0; i < pointsScreen->GetCount() - 1; dcId += 2) {
 		wxPoint *point_beg = (wxPoint *) pointsScreen->Item(i)->GetData();
 		wxPoint *point_end = (wxPoint *) pointsScreen->Item(++i)->GetData();
 
@@ -261,7 +263,7 @@
 	    }
 	    else {
 		wxPoint points[pointsScreen->GetCount()];
-		for (int i = 0; i < pointsScreen->GetCount(); i++) {
+		for (size_t i = 0; i < pointsScreen->GetCount(); i++) {
 		    wxPoint *point_beg = (wxPoint *) pointsScreen->Item(i)->GetData();
 		    points[i] = *point_beg;
 		}
@@ -317,7 +319,7 @@
     dc->SetId(dcId); /* 0 | 1 (selected) */
     dc->SetPen(*pen);
 
-    for (int i = 1; i < pointsScreen->GetCount() - 1; i++, dcId += 2) {
+    for (size_t i = 1; i < pointsScreen->GetCount() - 1; i++, dcId += 2) {
 	point = (wxPoint*) pointsScreen->Item(i)->GetData();
 
 	if (IsSelected(line) && drawSegments) {
@@ -364,7 +366,7 @@
     // get nodes
     Vect_get_line_nodes(mapInfo, line, &(nodes[0]), &(nodes[1]));
         
-    for (int i = 0; i < sizeof(nodes) / sizeof(int); i++) {
+    for (size_t i = 0; i < sizeof(nodes) / sizeof(int); i++) {
 	node = nodes[i];
 	// get coordinates
 	Vect_get_node_coor(mapInfo, node,
@@ -799,7 +801,6 @@
 						     double thresh, int type, int with_z)
 {
     long int line;
-    int ftype;
     double px, py, pz;
 
     std::vector<double> p;
@@ -884,7 +885,6 @@
 	return ListToVector(selected);
 
     std::vector<int> dc_ids;
-    long int line;
 
     if (!drawSegments) {
 	dc_ids.push_back(1);
@@ -979,7 +979,9 @@
     line = selected->value[0];
 
     type = Vect_read_line (mapInfo, points, cats, line);
-        
+
+    minDist = 0.0;
+    Gid = -1;
     // find the closest vertex (x, y)
     DCid = 1;
     for(int idx = 0; idx < points->n_points; idx++) {

Modified: grass/trunk/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/line.cpp	2008-02-15 21:44:24 UTC (rev 30172)
+++ grass/trunk/gui/wxpython/vdigit/line.cpp	2008-02-15 22:04:11 UTC (rev 30173)
@@ -38,8 +38,8 @@
 int Digit::AddLine(int type, std::vector<double> coords, int layer, int cat,
 		   const char *bgmap, int snap, double threshold)
 {
-    int i, npoints;
-    int newline;
+    size_t i;
+    size_t npoints;
 
     struct line_pnts *Points;
     struct line_cats *Cats;
@@ -130,8 +130,6 @@
 	Vect_close(BgMap[0]);
     }
 
-    G_debug(2, "wxDigit.AddLine(): line=%d written", newline);
-
     return 0;
 }
 
@@ -151,7 +149,6 @@
 		       const char *bgmap, int snap, double threshold)
 {
     int ret, type, dim;
-    double x, y, z;
     struct line_pnts *points;
     struct line_cats *cats;
 
@@ -442,9 +439,7 @@
 	return -1;
     }
 
-    /*
-      ret = Vedit_flip_lines(display->mapInfo, display->selected);
-    */
+    ret = Vedit_flip_lines(display->mapInfo, display->selected);
 
     return ret;
 }
@@ -493,13 +488,11 @@
 
    \param thresh threshold value for snapping
 
-   \return number of modified lines
+   \return 0 on success 
    \return -1 on error
 */
 int Digit::SnapLines(double thresh)
 {
-    int ret;
-
     if (!display->mapInfo) {
 	return -1;
     }
@@ -507,7 +500,7 @@
     Vect_snap_lines_list (display->mapInfo, display->selected,
 			  thresh, NULL, NULL);
 
-    return ret;
+    return 0;
 }
 
 /**
@@ -599,8 +592,8 @@
 	list = display->selected;
     }
 
-    Vedit_copy_lines (display->mapInfo, bgMap,
-		      list);
+    ret = Vedit_copy_lines (display->mapInfo, bgMap,
+			    list);
 
     if (list != display->selected) {
 	Vect_destroy_list(list);
@@ -640,6 +633,7 @@
     }
     
     nbgmaps = 0;
+    BgMap = NULL;
 
     if (!G__name_is_fully_qualified(bgmap, name, mapset)) {
 	G_strncpy(name, bgmap, GNAME_MAX);



More information about the grass-commit mailing list