Beispiel #1
0
        private void OptimizeHighway(BuildingRoutingDataRtgRoutingSourceEventArgs e)
        {
            featureSource.Open();
            Feature feature = featureSource.GetFeatureById(e.LineShape.Id, new string[] { "CFCC" });

            if (feature.ColumnValues["CFCC"].CompareTo("A4") < 0)
            {
                e.RouteSegment.RouteSegmentType = 2;
                e.RouteSegment.Weight           = e.RouteSegment.Weight * 0.1f;
            }
        }
Beispiel #2
0
 void RtgRoutingSource_BuildingRoadData(object sender, BuildingRoutingDataRtgRoutingSourceEventArgs e)
 {
     if (e.Feature.ColumnValues["CFCC"].CompareTo("A4") < 0)
     {
         e.Road.Length = e.Road.Length / SpeedOfHighWay;
     }
     else
     {
         e.Road.Length = e.Road.Length / SpeedOfLocalRoad;
     }
 }
Beispiel #3
0
        private void FastestPath(BuildingRoutingDataRtgRoutingSourceEventArgs e)
        {
            featureSource.Open();
            Feature feature = featureSource.GetFeatureById(e.LineShape.Id, new string[] { "CFCC" });

            if (feature.ColumnValues["CFCC"].CompareTo("A4") < 0)
            {
                e.RouteSegment.Weight = e.RouteSegment.Weight / SpeedOfHighWay;
            }
            else
            {
                e.RouteSegment.Weight = e.RouteSegment.Weight / SpeedOfLocalRoad;
            }
        }
Beispiel #4
0
        private void RtgRoutingSource_BuildingRoadData(object sender, BuildingRoutingDataRtgRoutingSourceEventArgs e)
        {
            if (panel1.Visible == false)
            {
                processedCount       = 0;
                pgBuildingData.Value = 0;
                panel1.Visible       = true;
                btnCancel.Visible    = true;
            }

            e.Cancel = cancel;
            processedCount++;
            pgBuildingData.PerformStep();
            lbProcessedCount.Text = processedCount.ToString(CultureInfo.InvariantCulture);
            Application.DoEvents();
        }
Beispiel #5
0
        private void RtgRoutingSource_BuildingRoadData(object sender, BuildingRoutingDataRtgRoutingSourceEventArgs e)
        {
            switch (cmbPurpose.Text.Trim())
            {
            case "FastestPath":
                FastestPath(e);
                break;

            case "DallasWithOneWayRoad":
                OneWayRoad(e);
                break;

            case "OptimizeHighway":
                OptimizeHighway(e);
                break;

            default:
                break;
            }
        }
Beispiel #6
0
        private void OneWayRoad(BuildingRoutingDataRtgRoutingSourceEventArgs e)
        {
            featureSource.Open();
            Feature feature = featureSource.GetFeatureById(e.LineShape.Id, new string[] { "One_way", "Indicator" });

            // One-Way	1=yes, 0=no
            string oneWay = feature.ColumnValues["One_way"];
            // Indicator 1=opposite to the routeSegment direction
            string indicator = feature.ColumnValues["Indicator"];

            if (oneWay == "1")
            {
                if (indicator == "0")
                {
                    e.RouteSegment.StartPointAdjacentIds.Clear();
                }
                else
                {
                    e.RouteSegment.EndPointAdjacentIds.Clear();
                }
            }
        }