[GRASS-SVN] r33283 - in grass/branches/develbranch_6/gui/wxpython: gui_modules vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 5 18:22:48 EDT 2008


Author: martinl
Date: 2008-09-05 18:22:48 -0400 (Fri, 05 Sep 2008)
New Revision: 33283

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
   grass/branches/develbranch_6/gui/wxpython/vdigit/Makefile
   grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp
Log:
wxGUI: display attributes bug fix (not found --- found)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2008-09-05 20:17:53 UTC (rev 33282)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2008-09-05 22:22:48 UTC (rev 33283)
@@ -2805,11 +2805,15 @@
         mainSizer.Fit(self)
 
         # set min size for dialog
-        self.SetMinSize(self.GetBestSize())
+        w, h = self.GetBestSize()
+        if h < 200:
+            self.SetMinSize((w, 200))
+        else:
+            self.SetMinSize(self.GetBestSize())
 
         if self.notebook.GetPageCount() == 0:
             Debug.msg(2, "DisplayAttributesDialog(): Nothing found!")
-            self.mapDBInfo = None
+            ### self.mapDBInfo = None
 
     def __SelectAttributes(self, layer):
         """Select attributes"""
@@ -2958,7 +2962,7 @@
             self.mapDBInfo = VectorDBInfo(self.map)
             
         self.line['id'] = (line, )
-        self.line['cats'] = None
+        self.line['cats'] = cats
         
         if not self.mapDBInfo:
             return False
@@ -3103,9 +3107,16 @@
         # for each layer END
 
         self.Layout()
-
+        
         return True
 
+    def IsFound(self):
+        """Check if attributes found"""
+        if self.notebook.GetPageCount() > 0:
+            return True
+        
+        return False
+        
 class VectorDBInfo(gselect.VectorDBInfo):
     """Class providing information about attribute tables
     linked to the vector map"""

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-09-05 20:17:53 UTC (rev 33282)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-09-05 22:22:48 UTC (rev 33283)
@@ -1223,9 +1223,9 @@
                                                                            line=line)
 
                     if self.parent.dialogs['attributes']:
-                        line = self.parent.dialogs['attributes'].GetLine()
-                        if self.parent.dialogs['attributes'].mapDBInfo and line:
+                        if self.parent.dialogs['attributes'].IsFound():
                             # highlight feature & re-draw map
+                            line = self.parent.dialogs['attributes'].GetLine()
                             digitClass.driver.SetSelected(line)
                             if not self.parent.dialogs['attributes'].IsShown():
                                 self.parent.dialogs['attributes'].Show()

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-09-05 20:17:53 UTC (rev 33282)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-09-05 22:22:48 UTC (rev 33283)
@@ -1151,7 +1151,7 @@
         
         @param line feature id (-1 for first selected line)
         """
-        return self.digit.GetLineCats(line)
+        return dict(self.digit.GetLineCats(line))
 
     def SetLineCats(self, line, layer, cats, add=True):
         """Set categories for given line and layer

Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/Makefile
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/Makefile	2008-09-05 20:17:53 UTC (rev 33282)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/Makefile	2008-09-05 22:22:48 UTC (rev 33283)
@@ -11,7 +11,7 @@
 ifeq ($(findstring darwin,$(ARCH)),darwin)
 EXTRA_LIBS := -bundle -undefined dynamic_lookup $(EXTRA_LIBS)
 else
-EXTRA_LIBS := $(EXTRA_LIBS) -lgdi
+EXTRA_LIBS := $(EXTRA_LIBS)
 endif
 
 LOCAL_HEADERS = digit.h driver.h

Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp	2008-09-05 20:17:53 UTC (rev 33282)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp	2008-09-05 22:22:48 UTC (rev 33283)
@@ -158,9 +158,8 @@
 std::map<int, std::vector<int> > Digit::GetLineCats(int line_id)
 {
     std::map<int, std::vector<int> > lc;
-    int line, n_dblinks;
+    int line;
     struct line_cats *Cats;
-    struct field_info *fi;
 
     if (!display->mapInfo) {
 	DisplayMsg();
@@ -189,20 +188,12 @@
 	ReadLineMsg(line);
 	return lc;
     }
-
-    n_dblinks = Vect_get_num_dblinks(display->mapInfo);
-
-    for (int dblink = 0; dblink < n_dblinks; dblink++) {
-	fi = Vect_get_dblink(display->mapInfo, dblink);
-	if (fi == NULL) {
-	    DblinkMsg(dblink+1);
-	    continue;
-	}
-	std::vector<int> cats;
-	lc[fi->number] = cats;
-    }
-
+    
     for (int i = 0; i < Cats->n_cats; i++) {
+	if (lc.find(Cats->field[i]) == lc.end()) {
+	    std::vector<int> cats;
+	    lc[Cats->field[i]] = cats;
+	}
 	lc[Cats->field[i]].push_back(Cats->cat[i]);
     }
 



More information about the grass-commit mailing list