Exemple #1
0
        public override void Step(TestSettings settings)
        {
            base.Step(settings);

            PolygonShape shape = new PolygonShape();

            shape.Set(m_points, e_count);

            m_debugDraw.DrawString("Press g to generate a new random convex hull");


            m_debugDraw.DrawPolygon(shape.m_vertices, shape.m_count, Color.FromArgb(225, 225, 225));

            for (int i = 0; i < e_count; ++i)
            {
                m_debugDraw.DrawPoint(m_points[i], 2.0f, Color.FromArgb(225, 128, 128));
                //m_debugDraw.DrawString(m_points[i] + new Vec2(0.05f, 0.05f), "%d", i);
            }

            if (shape.Validate() == false)
            {
                m_textLine += 0;
            }

            if (m_auto)
            {
                Generate();
            }
        }
Exemple #2
0
        private void btnRoute_Click(object sender, EventArgs e)
        {
            RtgRoutingSource routingSource = new RtgRoutingSource(@"..\..\SampleData\Austinstreets.rtg");
            RoutingEngine    routingEngine = new RoutingEngine(routingSource, featureSource);

            routingEngine.GeneratingServiceArea += new EventHandler <GeneratingServiceAreaRoutingEngineEventArgs>(routingEngine_GeneratingServiceArea);
            float averageSpeed   = float.Parse(txtAverageSpeed.Text);
            int   drivingMinutes = int.Parse(txtDrivingMinutes.Text);

            PolygonShape         polygonShape = routingEngine.GenerateServiceArea(txtStartId.Text, new TimeSpan(0, drivingMinutes, 0), averageSpeed);
            InMemoryFeatureLayer routingLayer = (InMemoryFeatureLayer)((LayerOverlay)winformsMap1.Overlays["RoutingOverlay"]).Layers["RoutingLayer"];

            routingLayer.InternalFeatures.Remove("ServiceArea");
            if (polygonShape.Validate(ShapeValidationMode.Simple).IsValid)
            {
                routingLayer.InternalFeatures.Add("ServiceArea", new Feature(polygonShape));
                routingLayer.Open();
                winformsMap1.CurrentExtent = routingLayer.GetBoundingBox();
                routingLayer.Close();
            }

            winformsMap1.Overlays["RoutingOverlay"].Lock.IsDirty = true;

            winformsMap1.Refresh();
        }
Exemple #3
0
        private void Route()
        {
            RtgRoutingSource routingSource = new RtgRoutingSource(Path.Combine(rootPath, "DallasCounty-4326.shortest.rtg"));
            FeatureSource    featureSource = new ShapeFileFeatureSource(Path.Combine(rootPath, "DallasCounty-4326.shp"));
            RoutingEngine    routingEngine = new RoutingEngine(routingSource, featureSource);

            float                averageSpeed   = float.Parse(txtAverageSpeed.Text);
            int                  drivingMinutes = int.Parse(txtDrivingMinutes.Text);
            SpeedUnit            speedUnit      = GetSpeedUnit();
            PolygonShape         polygonShape   = routingEngine.GenerateServiceArea(txtStartId.Text, new TimeSpan(0, drivingMinutes, 0), averageSpeed, speedUnit);
            InMemoryFeatureLayer routingLayer   = (InMemoryFeatureLayer)((LayerOverlay)winformsMap1.Overlays["RoutingOverlay"]).Layers["RoutingLayer"];

            routingLayer.InternalFeatures.Remove("ServiceArea");
            if (polygonShape.Validate(ShapeValidationMode.Simple).IsValid)
            {
                routingLayer.InternalFeatures.Add("ServiceArea", new Feature(polygonShape));
                routingLayer.Open();
                winformsMap1.CurrentExtent = routingLayer.GetBoundingBox();
                routingLayer.Close();
            }

            winformsMap1.Refresh(winformsMap1.Overlays["RoutingOverlay"]);
        }