Пример #1
0
    def __init__(self):
        Section.__init__(self)
        Coordinate.__init__(self)
        """Text of label is saved in name attribute defined in Coordinate base class."""

        ## ID label of an anchor node (optional)
        self.anchor_name = ''  # string

        ## type of object being metered by the label
        self.meter_type = MeterType.NONE

        ## ID of the object (Node or Link) being metered
        self.meter_name = ''

        ## label font
        self.font = ""

        ## label size
        self.size = 10.0

        ## True to use bold
        self.bold = False

        ## True to use italics
        self.italic = False
Пример #2
0
    def __init__(self):
        Coordinate.__init__(self)
        # self.name, inherited from Coordinate
        """Unique name or number identifying this node"""

        # self.x, self.y, inherited from Coordinate
        """Node location for mapping"""

        # self.description = ''
        """Optional description of the Node"""

        self.tag = ''
        """Optional label used to categorize or classify this Node"""
        def update_centroidlinks(self, geom):
            from qgis.core import QgsGeometry, QGis, QgsPoint
            feature_name = self.feature.attributes()[0]
            for section_field_name in self.session.section_types.values():
                try:
                    object = None
                    if self.layer == self.session.model_layers.layer_by_name(
                            section_field_name):
                        section = getattr(self.session.project,
                                          section_field_name)
                        object = section.value[feature_name]
                        if section_field_name != "subcatchments":
                            if hasattr(object, "vertices"):
                                del object.vertices[:]
                                for v in geom.asPolyline():
                                    coord = Coordinate()
                                    coord.x = v.x()
                                    coord.y = v.y()
                                    object.vertices.append(coord)
                    if object is not None and hasattr(object, "centroid"):
                        new_c_g = geom.centroid()
                        new_c = new_c_g.asPoint()
                        object.centroid.x = str(new_c.x)
                        object.centroid.y = str(new_c.y)
                        for fc in self.subcentroids.getFeatures():
                            if fc["sub_modelid"] == feature_name:
                                # from qgis.core import QgsMap
                                change_map = {fc.id(): new_c_g}
                                self.subcentroids.dataProvider(
                                ).changeGeometryValues(change_map)
                                break
                        for fl in self.sublinks.dataProvider().getFeatures():
                            if fl["inlet"] == self.feature["c_modelid"]:
                                if fl.geometry().wkbType(
                                ) == QGis.WKBLineString:
                                    line = fl.geometry().asPolyline()
                                    new_l_g = QgsGeometry.fromPolyline(
                                        [new_c, line[-1]])
                                    change_map = {fl.id(): new_l_g}
                                    self.sublinks.dataProvider(
                                    ).changeGeometryValues(change_map)
                                break

                    break
                except Exception as ex1:
                    print("Searching for object to edit vertex of: " +
                          str(ex1) + '\n' + str(traceback.print_exc()))
Пример #4
0
    def __init__(self):
        Coordinate.__init__(self)
        Section.__init__(self)
        # self.name, inherited from Coordinate
        """Unique name or number identifying this node"""

        # self.x, self.y, inherited from Coordinate
        """Node location for mapping"""

        #         self.description = ""
        #         """Optional description of the Node"""

        self.tag = ""
        """Optional label used to categorize or classify the Node"""

        self.initial_quality = 0.0
        """concentration for chemicals, hours for water age, or percent for source tracing"""
Пример #5
0
    def __init__(self):
        Section.__init__(self)
        Coordinate.__init__(self)
        """Text of label is saved in name attribute defined in Coordinate base class."""

        ## ID label of an anchor node (optional)
        self.anchor_name = ""  # string

        ## label font
        self.font = ""

        ## label size
        self.size = 10.0

        ## label bold
        self.bold = False

        ## lable italics
        self.italic = False
Пример #6
0
    def __init__(self, main_form, *args):
        QDialog.__init__(self, main_form)
        #self.helper = HelpHandler(self)
        #self.help_topic = "epanet/src/src/Register.htm"
        self.ui = Ui_frmTranslateCoordinatesDesigner()
        self.ui.setupUi(self)
        self.setModal(0)
        # self.cmdOK.clicked.connect(self.cmdOK_Clicked)
        # self.cmdCancel.clicked.connect(self.cmdCancel_Clicked)
        # self.toolButton.clicked.connect(self.toolButton_Clicked)
        self.ui.btnTranslate.clicked.connect(self.translate)
        self.ui.btnCancel.clicked.connect(self.cancel)
        self.ui.btnSelectCRS.clicked.connect(self.set_dst_crs)
        self.msg = ""
        self.model_layers = []
        self.pt_src_ll = Coordinate()
        self.pt_src_ur = Coordinate()
        self.pt_dst_ll = None
        self.pt_dst_ur = None
        if not args or len(args) < 2:
            self.msg = "Not enough coordinate information."
        else:
            self.set_coords_source_ll(args[0])
            self.set_coords_source_ur(args[1])

        # need to load table with selected file names
        self.GISDataFiles = {}
        self.file_filter = "Shapefile (*.shp);;All files (*.*)"
        self.data_path = ""
        if args:
            self.file_filter = args[0]
            if len(args) > 1:
                self.GISDataFiles = args[1]
        self._main_form = main_form
        self.model_map_crs_name = ""
        self.model_map_crs_unit = ""
        self.destination_crs_name = ""
        self.destination_crs_unit = ""
        self.set_from()
    def __init__(self):
        Section.__init__(self)
        Coordinate.__init__(self)

        self.description = None
        """Optional description of the gage"""

        self.tag = None
        """Optional label used to categorize the gage"""

        self.rain_format = RainFormat.VOLUME
        """Format in which the rain data are supplied:
            INTENSITY, VOLUME, CUMULATIVE (see also self.rain_units)"""

        self.rain_interval = 0.0
        """Recording time interval between gage readings in either decimal
            hours or hours:minutes format."""

        self.snow_catch_factor = 1
        """Factor that corrects gage readings for snowfall"""

        self.data_source = RainDataSource.TIMESERIES
        """Source of rainfall data; This can be set to a
            TimeSeries or a TimeSeriesFile."""

        self.timeseries = core.swmm.timeseries.TimeSeries()
        """time series with rainfall data if Data Source selection was TIMESERIES"""

        self.data_file_name = ""
        """Name of external file containing rainfall data"""

        self.data_file_station_id = ""
        """Recording gage station number"""

        self.data_file_rain_units = RainFileUnits.IN
        """Depth units (IN or MM) for rainfall values in the file"""
    def __init__(self):
        Section.__init__(self)
        Coordinate.__init__(self)

        ## Optional description of the gage
        self.description = ''

        ## Optional label used to categorize the gage
        self.tag = ''

        ## Format in which the rain data are supplied:
        ## INTENSITY, VOLUME, CUMULATIVE (see also self.rain_units)
        self.rain_format = RainFormat.VOLUME

        ## Recording time interval between gage readings in either decimal
        ## hours or hours:minutes format.
        self.rain_interval = "1:00"

        ## Factor that corrects gage readings for snowfall
        self.snow_catch_factor = 1.0

        ## Source of rainfall data; This can be set to a
        ## TimeSeries or a TimeSeriesFile.
        self.data_source = RainDataSource.TIMESERIES

        ## name of time series with rainfall data if Data Source selection was TIMESERIES
        self.timeseries = "None"

        ## Name of external file containing rainfall data
        self.data_file_name = "None"

        ## Recording gage station number
        self.data_file_station_id = "StationID"

        ## Depth units (IN or MM) for rainfall values in the file
        self.data_file_rain_units = RainFileUnits.IN
Пример #9
0
    def check_coords(self):
        # check source LL coordinates
        new_src_LL = Coordinate()
        val, val_is_good = ParseData.floatTryParse(self.ui.txtLL_src_x.text())
        if val_is_good:
            new_src_LL.x = val
        else:
            return False
        val, val_is_good = ParseData.floatTryParse(self.ui.txtLL_src_y.text())
        if val_is_good:
            new_src_LL.y = val
        else:
            return False

        # check source UR coordinates
        new_src_UR = Coordinate()
        val, val_is_good = ParseData.floatTryParse(self.ui.txtUR_src_x.text())
        if val_is_good:
            new_src_UR.x = val
        else:
            return False
        val, val_is_good = ParseData.floatTryParse(self.ui.txtUR_src_y.text())
        if val_is_good:
            new_src_UR.y = val
        else:
            return False

        # check destination LL coordinates
        new_dst_LL = Coordinate()
        val, val_is_good = ParseData.floatTryParse(self.ui.txtLL_dst_x.text())
        if val_is_good:
            new_dst_LL.x = val
        else:
            return False
        val, val_is_good = ParseData.floatTryParse(self.ui.txtLL_dst_y.text())
        if val_is_good:
            new_dst_LL.y = val
        else:
            return False

        # check destination UR coordinates
        new_dst_UR = Coordinate()
        val, val_is_good = ParseData.floatTryParse(self.ui.txtUR_dst_x.text())
        if val_is_good:
            new_dst_UR.x = val
        else:
            return False
        val, val_is_good = ParseData.floatTryParse(self.ui.txtUR_dst_y.text())
        if val_is_good:
            new_dst_UR.y = val
        else:
            return False

        self.pt_src_ll.x = new_src_LL.x
        self.pt_src_ll.y = new_src_LL.y
        self.pt_src_ur.x = new_src_UR.x
        self.pt_src_ur.y = new_src_UR.y

        if not self.pt_dst_ll:
            self.pt_dst_ll = type(self.pt_src_ll)()
        if not self.pt_dst_ur:
            self.pt_dst_ur = type(self.pt_src_ur)()
        self.pt_dst_ll.x = new_dst_LL.x
        self.pt_dst_ll.y = new_dst_LL.y
        self.pt_dst_ur.x = new_dst_UR.x
        self.pt_dst_ur.y = new_dst_UR.y

        return True
    def __init__(self):
        Section.__init__(self)
        Polygon.__init__(self)

        ## Coordinates: Subcatchment's centroid on the Study Area Map.
        ## If not set, the subcatchment will not appear on the map.
        self.centroid = Coordinate()

        ## str: Optional description of the Subcatchment.
        self.description = ''

        ## Optional label used to categorize or classify the Subcatchment.
        self.tag = ''

        ## str: The RainGage ID associated with the Subcatchment.
        self.rain_gage = 'None'

        ## The Node or Subcatchment which receives Subcatchment's runoff.
        self.outlet = 'None'

        ## float: Area of the subcatchment (acres or hectares).
        self.area = 0.0

        ## float: Percent of land area which is impervious.
        self.percent_impervious = 0.0

        ## Characteristic width of the overland flow path for sheet flow
        ## runoff (feet or meters). An initial estimate of the characteristic
        ## width is given by the subcatchment area divided by the average
        ## maximum overland flow length. The maximum overland flow
        ## length is the length of the flow path from the the furthest drainage
        ## point of the subcatchment before the flow becomes channelized.
        ## Maximum lengths from several different possible flow paths
        ## should be averaged. These paths should reflect slow flow, such as
        ## over pervious surfaces, more than rapid flow over pavement, for
        ## example. Adjustments should be made to the width parameter to
        ## produce good fits to measured runoff hydrographs.
        self.width = 0.0

        ## float: Average percent slope of the subcatchment.
        self.percent_slope = 0.0

        ## float: Manning's n for overland flow in impervious part of Subcatchment
        self.n_imperv = 0.0

        ## Manning's n for overland flow in pervious part of Subcatchment
        self.n_perv = 0.0

        ## float: Depth of depression storage on the impervious portion of the
        ## Subcatchment (inches or millimeters)
        self.storage_depth_imperv = 0.0

        ## float: Depth of depression storage on the pervious portion of the
        ## Subcatchment (inches or millimeters)
        self.storage_depth_perv = 0.0

        ## float: Percent of the impervious area with no depression storage.
        self.percent_zero_impervious = 0.0

        ## Routing: Internal routing of runoff between pervious and impervious areas
        self.subarea_routing = Routing.OUTLET

        ## float: Percent of runoff routed between subareas
        self.percent_routed = 100.0

        ## infiltration parameters from horton, green-ampt, or scs classes
        self.infiltration_parameters = HortonInfiltration()
        #self.infiltration_parameters.subcatchment = self.name

        ## Snow pack parameter set (if any) of the subcatchment.
        self.snow_pack = ''

        ## Total length of curbs in the subcatchment (any length units).
        ## Used only when initial_loadings are normalized to curb length.
        self.curb_length = 0

        ## Optional monthly pattern that adjusts pervious Mannings N
        self.nperv_pattern = ''

        ## Optional monthly pattern that adjusts depression storage
        self.dstore_pattern = ''

        ## Optional monthly pattern that adjusts infiltration rate
        self.infil_pattern = ''
Пример #11
0
    def __init__(self):
        Section.__init__(self)
        Polygon.__init__(self)

        self.centroid = Coordinate()
        """Coordinates: Subcatchment's centroid on the Study Area Map.
            If not set, the subcatchment will not appear on the map."""

        self.description = ''
        """str: Optional description of the Subcatchment."""

        self.tag = ''
        """Optional label used to categorize or classify the Subcatchment."""

        self.rain_gage = ''
        """str: The RainGage ID associated with the Subcatchment."""

        self.outlet = ''
        """The Node or Subcatchment which receives Subcatchment's runoff."""

        self.area = ''
        """float: Area of the subcatchment (acres or hectares)."""

        self.percent_impervious = ''
        """float: Percent of land area which is impervious."""

        self.width = ''
        """Characteristic width of the overland flow path for sheet flow
            runoff (feet or meters). An initial estimate of the characteristic
            width is given by the subcatchment area divided by the average
            maximum overland flow length. The maximum overland flow
            length is the length of the flow path from the the furthest drainage
            point of the subcatchment before the flow becomes channelized.
            Maximum lengths from several different possible flow paths
            should be averaged. These paths should reflect slow flow, such as
            over pervious surfaces, more than rapid flow over pavement, for
            example. Adjustments should be made to the width parameter to
            produce good fits to measured runoff hydrographs."""

        self.percent_slope = ''
        """float: Average percent slope of the subcatchment."""

        self.n_imperv = ''
        """float: Manning's n for overland flow in impervious part of Subcatchment"""

        self.n_perv = ''
        """Manning's n for overland flow in pervious part of Subcatchment"""

        self.storage_depth_imperv = ''
        """float: Depth of depression storage on the impervious portion of the
            Subcatchment (inches or millimeters) """

        self.storage_depth_perv = ''
        """float: Depth of depression storage on the pervious portion of the
            Subcatchment (inches or millimeters)"""

        self.percent_zero_impervious = ''
        """float: Percent of the impervious area with no depression storage."""

        self.subarea_routing = Routing.OUTLET
        """Routing: Internal routing of runoff between pervious and impervious areas"""

        self.percent_routed = ''
        """float: Percent of runoff routed between subareas"""

        self.infiltration_parameters = HortonInfiltration()
        """infiltration parameters from horton, green-ampt, or scs classes"""

        self.groundwater = ''
        """Groundwater flow parameters for the subcatchment."""

        self.snow_pack = ''
        """Snow pack parameter set (if any) of the subcatchment."""

        self.curb_length = ''
        """ Total length of curbs in the subcatchment (any length units).
Пример #12
0
 def __init__(self, node_id: int, lng: float, lat: float):
     self.node_id = node_id
     self.location = Coordinate(lng, lat)
     self.out_edges = {}
     self.in_edges = {}
 def __init__(self, x, y, link):
     Coordinate.__init__(self, x, y)
     self.link = link