def getBarPath(self): # Valid path element should have at least 3 points otherwise, SVG path # cannot be generated. if len(self._points) < 3: raise TypeError,\ "Invalid contour element provided. Contour should consist of 3 and more points." # The structure0 prefix is to adjust the path id to the general template # which is structure%numer%_%nazwalabelki%_%nazwastruktury% pathID = 'structure0_%s_%s' % (self._properties['GUID'], self._name) return barPath(pathID, self.pathDefinition, self._color)
def _parseSingleStructure(self, structureIDbyFill, structurePathList): """ @type structureIDbyFill: string @param structureIDbyFill: color-encoded structure ID which will be processed @type structurePathList: list @param structurePathList: list of path corresponding to given structure on given slide @return: None Function extracts all paths from given slide having filled with 'structureIDbyFill' color. At the end of processing, path is appended to the slide. @todo: # TODO: Arrange code in each function to make it more reusable """ # Define and store fill color and name of the structure currentStructureData = {} currentStructureData['fillcolor'] = structureIDbyFill currentStructureData['name'] = self._getStructureName( structureIDbyFill) # Process all polygons describing given structure in a loop. # (there may by more than one polygon describing given structure per # slide) retPaths = [] for pathNumber in structurePathList: # Increase structure iterator value: to make ID's uniqe self.slideStructureIndexer += 1 # Gater all requires path properties and create path object newPathDefinition = self._sbaImportData['svgpaths'][pathNumber] newPathColor = currentStructureData['fillcolor'] newPathID = self._getPathID(currentStructureData['name']) try: pathToAppend = barPath(newPathID,\ newPathDefinition, newPathColor, clearPathDef = True) retPaths.append(pathToAppend) except ValueError: pass # Dumping diagnostic information if __debug__: print >> sys.stderr, "\t\tExtracting structure %s" % currentStructureData[ 'name'] print >> sys.stderr, "\t\tFill color of current structure %s" % currentStructureData[ 'fillcolor'] print >> sys.stderr, "\t\tNumber of polygons creating this structure %d" % len( structurePathList) print >> sys.stderr, "\t\t\t!FULLDUMP!Full structure dump: %s" % structurePathList print >> sys.stderr, "\t\tStarting processing paths." return retPaths
def _parseSingleStructure(self, structureIDbyFill, structurePathList): """ @type structureIDbyFill: string @param structureIDbyFill: color-encoded structure ID which will be processed @type structurePathList: list @param structurePathList: list of path corresponding to given structure on given slide @return: None Function extracts all paths from given slide having filled with 'structureIDbyFill' color. At the end of processing, path is appended to the slide. @todo: # TODO: Arrange code in each function to make it more reusable """ # Define and store fill color and name of the structure currentStructureData = {} currentStructureData['fillcolor'] = structureIDbyFill currentStructureData['name'] = self._getStructureName(structureIDbyFill) # Process all polygons describing given structure in a loop. # (there may by more than one polygon describing given structure per # slide) retPaths = [] for pathNumber in structurePathList: # Increase structure iterator value: to make ID's uniqe self.slideStructureIndexer+=1 # Gater all requires path properties and create path object newPathDefinition = self._sbaImportData['svgpaths'][pathNumber] newPathColor = currentStructureData['fillcolor'] newPathID = self._getPathID(currentStructureData['name']) try: pathToAppend = barPath(newPathID,\ newPathDefinition, newPathColor, clearPathDef = True) retPaths.append(pathToAppend) except ValueError: pass # Dumping diagnostic information if __debug__: print >>sys.stderr, "\t\tExtracting structure %s" % currentStructureData['name'] print >>sys.stderr, "\t\tFill color of current structure %s" % currentStructureData['fillcolor'] print >>sys.stderr, "\t\tNumber of polygons creating this structure %d" % len(structurePathList) print >>sys.stderr, "\t\t\t!FULLDUMP!Full structure dump: %s" % structurePathList print >>sys.stderr, "\t\tStarting processing paths." return retPaths