示例#1
0
    def process(self):
        """Main routine for the Sherbend algorithm
        
        The algorithm will simplify the lines using the Sherbend algorithm. 
        It will iterate over the lines until there are no more bends to simplify.

        Parameters
        ----------
        None

        Returns
        -------
        geo_content : DataClass
            Contains the output information

        """

        # Load the features into the spatial container
        self.load_features(self.geo_content, self.command)

        s_constraints = SpatialConstraints(s_container=self.s_container)

        self._manage_lines_simplification(s_constraints)

        for feature in self.s_container.get_features():
            if feature.sb_geom_type == GenUtil.POINT:
                self.geo_content.out_features.append(feature)
            elif feature.sb_geom_type == GenUtil.LINE_STRING:
                if feature.sb_original_type == GenUtil.LINE_STRING:
                    self.geo_content.out_features.append(feature)
                else:
                    if feature.sb_original_type == GenUtil.POLYGON_EXTERIOR:
                        # The LineString was an exterior Polygon so reconstruct the originalPolygon
                        interiors = [
                            list(interior.coords)
                            for interior in feature.sb_interiors
                        ]
                        polygon = Polygon(feature.coords, interiors)
                        polygon.sb_layer_name = feature.sb_layer_name
                        polygon.sb_properties = feature.sb_properties
                        self.geo_content.out_features.append(polygon)
                    else:
                        pass  # Nothing to do with the holes here

        return