public void UpdateObserver_ReferenceLineUpdated_MapDataUpdated()
        {
            // Setup
            AssessmentSection assessmentSection = CreateAssessmentSectionWithReferenceLine();
            ReferenceLine     referenceLine     = assessmentSection.ReferenceLine;

            using (var view = new AssemblyResultPerSectionMapView(assessmentSection))
            {
                IMapControl map = GetMapControl(view);

                var         mocks     = new MockRepository();
                IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
                observers[assemblyResultsObserverIndex].Expect(obs => obs.UpdateObserver());
                observers[referenceLineIndex].Expect(obs => obs.UpdateObserver());
                mocks.ReplayAll();

                MapData referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex);

                // Precondition
                AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);

                // Call
                referenceLine.SetGeometry(new[]
                {
                    new Point2D(2.0, 5.0),
                    new Point2D(4.0, 3.0)
                });
                referenceLine.NotifyObservers();

                // Assert
                AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);
                mocks.VerifyAll();
            }
        }
        public void UpdateObserver_AssessmentSectionUpdated_MapDataUpdated()
        {
            // Setup
            AssessmentSection assessmentSection = CreateAssessmentSectionWithReferenceLine();

            using (var view = new AssemblyResultPerSectionMapView(assessmentSection))
            {
                IMapControl map = GetMapControl(view);

                var         mocks     = new MockRepository();
                IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
                observers[referenceLineIndex].Expect(obs => obs.UpdateObserver());
                observers[assemblyResultsObserverIndex].Expect(obs => obs.UpdateObserver());
                mocks.ReplayAll();

                var referenceLineMapData = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);

                // Precondition
                MapFeaturesTestHelper.AssertReferenceLineMetaData(assessmentSection.ReferenceLine, assessmentSection, referenceLineMapData.Features);
                AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);

                // Call
                assessmentSection.Name = "New name";
                assessmentSection.NotifyObservers();

                // Assert
                MapFeaturesTestHelper.AssertReferenceLineMetaData(assessmentSection.ReferenceLine, assessmentSection, referenceLineMapData.Features);
                mocks.VerifyAll();
            }
        }
예제 #3
0
        public void Setup(IMapControl mapControl)
        {
            var mapView = mapControl as MapView;

            mapControl.Map    = OsmSample.CreateMap();
            mapView.Navigator = new AnimatedNavigator(mapView.Map, (IViewport)mapView.Viewport);
        }
예제 #4
0
 internal static void Init(IMapControl mapcontrol)
 {
     foreach (IMapCommand cmd in _regedTools.Values)
     {
         (cmd as MapCommand).SetMapControl(mapcontrol);
     }
 }
예제 #5
0
        public override void Click()
        {
            IMapControl     mapControl = (_hook as IHookOfAgileMap).MapControl;
            IOperationStack oprStack   = mapControl.OperationStack;

            oprStack.Redo();
        }
예제 #6
0
        /// <summary>
        /// 重写鼠标down事件
        /// </summary>
        /// <param name="sender">事件触发器</param>
        /// <param name="e">事件参数</param>
        public override void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (m_HookHelper.ActiveView == null)
            {
                return;
            }
            //制图模式
            else if (m_HookHelper.Hook is IPageLayoutControl)
            {
                m_PageLayoutControl = m_HookHelper.Hook as IPageLayoutControl;
                //画的矩形Extent
                IEnvelope trackExtent = m_PageLayoutControl.TrackRectangle();
                PIE.Geometry.IEnvelope currentExtent = m_PageLayoutControl.ActiveView.DisplayTransformation.VisibleBounds;
                double xMin, yMin, xMax, yMax;
                xMin = yMin = xMax = yMax = 0;
                m_PageLayoutControl.PageLayout.PageToMapPoint(m_HookHelper.FocusMap, trackExtent.XMin, trackExtent.YMin, ref xMin, ref yMin);
                m_PageLayoutControl.PageLayout.PageToMapPoint(m_HookHelper.FocusMap, trackExtent.XMax, trackExtent.YMax, ref xMax, ref yMax);

                IEnvelope extent = new Envelope();
                extent.PutCoords(xMin, yMin, xMax, yMax);
                //计算一个缩放比例
                double scale = currentExtent.GetWidth() * 1.00 / (trackExtent as IEnvelope).GetWidth();
                //缩放比例与地图模式下的基本一致
                extent.Expand(scale * 1.3, scale * 1.3, true);
                (m_PageLayoutControl.FocusMap as IActiveView).Extent = extent;
                (m_PageLayoutControl.FocusMap as IActiveView).PartialRefresh(ViewDrawPhaseType.ViewAll);
            }
            //地图模式
            else if (m_HookHelper.Hook is IMapControl)
            {
                m_MapControl = m_HookHelper.Hook as IMapControl;
                //画的矩形Extent
                IEnvelope trackExtent = m_MapControl.TrackRectangle();
                if (trackExtent == null)
                {
                    return;
                }
                //获取当前的Extent
                IEnvelope currentExtent = m_MapControl.Extent;
                IEnvelope newExtent     = null;
                //创建一个新的Extent
                double dWidth = currentExtent.GetWidth() * (currentExtent.GetWidth() / trackExtent.GetWidth());

                double dHeight = currentExtent.GetHeight() * (currentExtent.GetHeight() / trackExtent.GetHeight());

                double dXmin = currentExtent.XMin - ((trackExtent.XMin - currentExtent.XMin) * (currentExtent.GetWidth() / trackExtent.GetWidth()));

                double dYmin = currentExtent.YMin - ((trackExtent.YMin - currentExtent.YMin) * (currentExtent.GetHeight() / trackExtent.GetHeight()));

                double dXmax = (currentExtent.XMin - ((trackExtent.XMin - currentExtent.XMin) * (currentExtent.GetWidth() / trackExtent.GetWidth()))) + dWidth;

                double dYmax = (currentExtent.YMin - ((trackExtent.YMin - currentExtent.YMin) * (currentExtent.GetHeight() / trackExtent.GetHeight()))) + dHeight;

                //设置extent coordinate
                newExtent = new Envelope();
                newExtent.PutCoords(dXmin, dYmin, dXmax, dYmax);
                m_MapControl.Extent = newExtent;
                m_MapControl.PartialRefresh(ViewDrawPhaseType.ViewAll);
            }
        }
예제 #7
0
        public IList <IMapControlLayer> MapLayers(IMapControl mapControl)
        {
            MapControlLayer layer = MapControlLayer.Instance;

            layer.MapControl = mapControl;
            return(new IMapControlLayer[] { layer });
        }
        public PointLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();

            this.myMap                  = myMap;
            this.dashboardHelper        = dashboardHelper;
            this.mapControl             = mapControl;
            mapControl.TimeVariableSet += new TimeVariableSetHandler(mapControl_TimeVariableSet);
            mapControl.MapDataChanged  += new EventHandler(mapControl_MapDataChanged);

            provider = new PointLayerProvider(myMap);
            provider.DateRangeDefined     += new DateRangeDefinedHandler(provider_DateRangeDefined);
            provider.RecordSelected       += new RecordSelectedHandler(provider_RecordSelected);
            cbxLatitude.SelectionChanged  += new SelectionChangedEventHandler(coord_SelectionChanged);
            cbxLongitude.SelectionChanged += new SelectionChangedEventHandler(coord_SelectionChanged);
            rctColor.MouseUp += new MouseButtonEventHandler(rctColor_MouseUp);
            //rctFilter.MouseUp += new MouseButtonEventHandler(rctFilter_MouseUp);
            rctEdit.MouseUp += new MouseButtonEventHandler(rctEdit_MouseUp);
            FillComboBoxes();

            #region translation;
            lblTitle.Content        = DashboardSharedStrings.GADGET_LABEL_SPOTS;
            lblDescription.Content  = DashboardSharedStrings.GADGET_LABEL_DESCRIPTION;
            lblStyle.Content        = DashboardSharedStrings.GADGET_LABEL_STYLE;
            lblLatitude.Content     = DashboardSharedStrings.GADGET_LATITUDE_FIELD;
            lblLongitude.Content    = DashboardSharedStrings.GADGET_LONGITUDE_FIELD;
            rctColorToolTip.Content = DashboardSharedStrings.MAP_POINT_COLOR;
            rctEditToolTip.Content  = DashboardSharedStrings.MAP_LAYER_EDIT;
            #endregion ;//translation
        }
예제 #9
0
        private async void SetBoundaries(IMapControl map, Tuple <TimeSpan, Stop>[] stops)
        {
            var boundaries = GetBoundaries(stops.Select(s => s.Item2.Coordinate));
            await Task.Delay(250);

            map.TrySetViewBoundsAsync(boundaries, false);
        }
예제 #10
0
 protected override void MouseUp(IMapControl mapcontrol, MouseEventArgs e)
 {
     if (!_draging)
     {
         return;
     }
     try
     {
         int     minx = Math.Min(_startPoint.X, _endPoint.X);
         int     maxx = Math.Max(_startPoint.X, _endPoint.X);
         int     miny = Math.Min(_startPoint.Y, _endPoint.Y);
         int     maxy = Math.Max(_startPoint.Y, _endPoint.Y);
         Point[] pts  = new Point[] { new Point(minx, miny), new Point(maxx, maxy) };
         mapcontrol.CoordinateTransfrom.PixelCoord2PrjCoord(pts);
         RectangleF rect = RectangleF.FromLTRB(pts[0].X, -pts[0].Y, pts[1].X, -pts[1].Y);
         HandleZoom(mapcontrol, rect);
         (mapcontrol as IMapControlDummySupprot).ResetToNormalRenderMode();
         mapcontrol.ReRender();
     }
     finally
     {
         _startPoint = Point.Empty;
         _endPoint   = Point.Empty;
         _draging    = false;
     }
 }
예제 #11
0
        public void Setup(IMapControl mapControl)
        {
            mapControl.Map = OsmSample.CreateMap();

            ((MapView)mapControl).UseDoubleTap  = true;
            ((MapView)mapControl).UniqueCallout = true;

            var sw = new Stopwatch();

            sw.Start();

            // Add 1000 pins
            var list = new System.Collections.Generic.List <Pin>();

            for (var i = 0; i < 1000; i++)
            {
                list.Add(CreatePin(i));
            }

            var timePart1 = sw.Elapsed;

            ((ObservableRangeCollection <Pin>)((MapView)mapControl).Pins).AddRange(list);

            var timePart2 = sw.Elapsed;

            sw.Stop();
        }
        public void GivenViewWithStochasticSoilModels_WhenStochasticSoilModelsUpdatedAndNotified_ThenMapDataUpdated()
        {
            // Given
            var failureMechanism = new MacroStabilityInwardsFailureMechanism();

            MacroStabilityInwardsFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            var stochasticSoilModelMapData = (MapLineData)map.Data.Collection.ElementAt(stochasticSoilModelsIndex);

            var mocks = new MockRepository();

            IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
            observers[stochasticSoilModelsIndex].Expect(obs => obs.UpdateObserver());
            mocks.ReplayAll();

            // When
            failureMechanism.StochasticSoilModels.AddRange(new[]
            {
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("", new[]
                {
                    new Point2D(1, 2),
                    new Point2D(1, 2)
                })
            }, "path");
            failureMechanism.StochasticSoilModels.NotifyObservers();

            // Then
            AssertStochasticSoilModelsMapData(failureMechanism.StochasticSoilModels, stochasticSoilModelMapData);
            mocks.VerifyAll();
        }
        public void GivenViewWithSurfaceLineData_WhenSurfaceLineUpdatedAndNotified_ThenMapDataUpdated()
        {
            // Given
            var surfaceLine      = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var failureMechanism = new MacroStabilityInwardsFailureMechanism();

            failureMechanism.SurfaceLines.AddRange(new[]
            {
                surfaceLine
            }, "path");

            MacroStabilityInwardsFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            var mocks = new MockRepository();

            IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
            observers[surfaceLinesIndex].Expect(obs => obs.UpdateObserver());
            mocks.ReplayAll();

            // When
            surfaceLine.SetGeometry(new[]
            {
                new Point3D(7, 8, 9),
                new Point3D(10, 11, 12)
            });
            surfaceLine.NotifyObservers();

            // Then
            var surfaceLineMapData = (MapLineData)map.Data.Collection.ElementAt(surfaceLinesIndex);

            AssertSurfaceLinesMapData(failureMechanism.SurfaceLines, surfaceLineMapData);
            mocks.VerifyAll();
        }
예제 #14
0
        public static Map CreateMap(IMapControl mapControl)
        {
            var style = new SymbolStyle()
            {
                Fill = new Brush(Color.Red), SymbolScale = 1,
            };

            var map = new Map();

            map.Layers.Add(OpenStreetMap.CreateTileLayer());
            map.Layers.Add(CreateLayer(style));

            var animations = CreateAnimationsForSymbolStyle(style);

            // todo: Introduce one Animation for the MapControl that could be reused here.
            var animation = new Animation();

            animation.Ticked += (s, e) =>
            {
                animation.UpdateAnimations();
                mapControl.Refresh();
            };
            animation.Start(animations, 10000);

            return(map);
        }
예제 #15
0
        private IList <IGPSLocation> getSelectedGPSLocations(IMapDrawContext drawContext)
        {
            IList <IGPSLocation> list = new List <IGPSLocation>()
            {
            };
            IMapControl mapControl = UI.MapLayers.MapControlLayer.Instance.MapControl;

            ICollection <IMapControlObject> selectedGPS = mapControl.Selected;

            if (selectedGPS.Count > 0)
            {
                IMapControlObject[] selectedMapControlObjects = new IMapControlObject[selectedGPS.Count];
                selectedGPS.CopyTo(selectedMapControlObjects, 0);
                for (int i = 0; i < selectedGPS.Count; i++)
                {
                    Rectangle rec = selectedMapControlObjects[i].PixelBounds(drawContext);

                    int          X   = rec.X + (rec.Width / 2) - (drawContext.DrawRectangle.Width / 2);
                    int          Y   = rec.Y + (rec.Height / 2) - (drawContext.DrawRectangle.Height / 2);
                    IGPSLocation loc = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(X, Y));
                    list.Add(loc);
                }
            }
            return(list);
        }
예제 #16
0
 public void SetBuddy(IMapControl mapcontrol)
 {
     _mapcontrol = mapcontrol;
     _mapcontrol.MapServerAgent.MapServiceClient.GeoEnvelope2PrjEnvelopeCompleted += new EventHandler <AgileMapServiceProxy.GeoEnvelope2PrjEnvelopeCompletedEventArgs>(MapServiceClient_GeoEnvelope2PrjEnvelopeCompleted);
     _mapcontrol.MapServerAgent.MapServiceClient.GetMapImageCompleted             += new EventHandler <GetMapImageCompletedEventArgs>(MapServiceClient_GetMapImageCompleted);
     _mapcontrol.OnMapControlViewportChanged += new OnMapControlViewportChangedHandler(OnMapControlViewportChanged);
 }
예제 #17
0
        private void SetLayerMgrDefaultLocation(Form frm, IMapControl mapControl)
        {
            Point pt = (mapControl as Control).PointToScreen(new Point(0, 0));

            frm.Location = pt;
            frm.Height   = (mapControl as Control).Height - 4;
        }
        public DotDensityServerLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();
            this.myMap           = myMap;
            this.dashboardHelper = dashboardHelper;
            this.mapControl      = mapControl;

            // provider = new DotDensityServerLayerProvider(myMap);
            // provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded);

            FillComboBoxes();
            mapControl.MapDataChanged    += new EventHandler(mapControl_MapDataChanged);
            cbxDataKey.SelectionChanged  += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxValue.SelectionChanged    += new SelectionChangedEventHandler(keys_SelectionChanged);
            rctDotColor.MouseUp          += new MouseButtonEventHandler(rctDotColor_MouseUp);
            rctEdit.MouseUp += new MouseButtonEventHandler(rctEdit_MouseUp);

            #region translation;
            lblTitle.Content       = DashboardSharedStrings.GADGET_CONFIG_TITLE_DOTDENSITY;
            lblClasses.Content     = DashboardSharedStrings.GADGET_MAP_DOT_VALUE;
            lblShapeKey.Content    = DashboardSharedStrings.GADGET_MAP_FEATURE;
            lblDataKey.Content     = DashboardSharedStrings.GADGET_MAP_DATA;
            lblValueField.Content  = DashboardSharedStrings.GADGET_MAP_VALUE;
            rctEditToolTip.Content = DashboardSharedStrings.MAP_LAYER_EDIT;
            #endregion ;//translation
        }
예제 #19
0
        private void AddNodeToMap(IMapControl map, Image item, MouseButtonEventArgs eventArgs)
        {
            TypeManager    typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>();
            INodeTypeProxy nodeType    = null;

            if (item.Name == "IdeaImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumIdeaNode");
            }
            else if (item.Name == "ProImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumProNode");
            }
            else if (item.Name == "ConImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumConNode");
            }
            else if (item.Name == "QuestionImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumQuestionNode");
            }
            else if (item.Name == "MapImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumMapNode");
            }
            else if (item.Name == "DecisionImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumDecisionNode");
            }

            map.Navigator.AddNode(nodeType, "", eventArgs.GetPosition(map as UIElement));
        }
예제 #20
0
        public void GivenViewWithCalculationGroupData_WhenCalculationGroupUpdatedAndNotified_ThenMapDataUpdated()
        {
            // Given
            var failureMechanism = new PipingFailureMechanism();

            PipingFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            var surfaceLineA = new PipingSurfaceLine(string.Empty);

            surfaceLineA.SetGeometry(new[]
            {
                new Point3D(0.0, 0.0, 1.0),
                new Point3D(3.0, 0.0, 1.7)
            });

            var surfaceLineB = new PipingSurfaceLine(string.Empty);

            surfaceLineB.SetGeometry(new[]
            {
                new Point3D(0.0, 0.0, 1.5),
                new Point3D(3.0, 0.0, 1.8)
            });
            surfaceLineA.ReferenceLineIntersectionWorldPoint = new Point2D(1.3, 1.3);
            surfaceLineB.ReferenceLineIntersectionWorldPoint = new Point2D(1.5, 1.5);

            var calculationA =
                SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <SemiProbabilisticPipingCalculationScenario>(
                    new TestHydraulicBoundaryLocation());
            var calculationB =
                ProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <ProbabilisticPipingCalculationScenario>(
                    new TestHydraulicBoundaryLocation());

            calculationA.InputParameters.SurfaceLine = surfaceLineA;
            calculationB.InputParameters.SurfaceLine = surfaceLineB;

            failureMechanism.CalculationsGroup.Children.Add(calculationA);
            failureMechanism.CalculationsGroup.Children.Add(calculationB);

            var probabilisticCalculationMapData     = (MapLineData)map.Data.Collection.ElementAt(probabilisticCalculationsIndex);
            var semiProbabilisticCalculationMapData = (MapLineData)map.Data.Collection.ElementAt(semiProbabilisticCalculationsIndex);

            var mocks = new MockRepository();

            IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
            observers[semiProbabilisticCalculationObserverIndex].Expect(obs => obs.UpdateObserver());
            observers[probabilisticCalculationObserverIndex].Expect(obs => obs.UpdateObserver());
            mocks.ReplayAll();

            // When
            failureMechanism.CalculationsGroup.Children.Add(calculationB);
            failureMechanism.CalculationsGroup.NotifyObservers();

            // Then
            AssertSemiProbabilisticCalculationsMapData(failureMechanism.Calculations.OfType <SemiProbabilisticPipingCalculationScenario>(), semiProbabilisticCalculationMapData);
            AssertProbabilisticCalculationsMapData(failureMechanism.Calculations.OfType <ProbabilisticPipingCalculationScenario>(), probabilisticCalculationMapData);
            mocks.VerifyAll();
        }
예제 #21
0
        private void openPopup(IMapControl page, PlanItemPopupModel popupModel, bool downside = false)
        {
            var popupContent = new PlanItemPopup(page);

            popupContent.SetModel(popupModel);
            openedPopupLayers.Add(popupContent);
            AddControlToMap(popupContent, popupModel.Stop.Coordinate, new Point(0.5, downside ? 0 : 1));
        }
예제 #22
0
 private async Task tryCreateHighStopLabelsAt(IMapControl page, GeoCoordinate currentLocation)
 {
     if (!highMarkedLocations.Any(loc => currentLocation.GetDistanceTo(loc) < App.Config.HighStopsRadius * 0.8))
     {
         highMarkedLocations.Add(currentLocation);
         await createStopLabelsAt(page, currentLocation, priorityLimit : 2.1, radius : App.Config.HighStopsRadius);
     }
 }
예제 #23
0
        void OnMapControlViewportChanged(object sender, PrjRectangleF oldviewport, PrjRectangleF newviewport)
        {
            IMapControl mapcontrol = sender as IMapControl;

            txtDistance.Text   = (ActualWidth * mapcontrol.Resolution / 1000).ToString("0.###") + "公里";
            txtScale.Text      = "1:" + mapcontrol.Scale.ToString();
            txtResolution.Text = mapcontrol.Resolution.ToString("0.00") + "米";
        }
예제 #24
0
 protected override void MouseMove(IMapControl mapcontrol, MouseEventArgs e)
 {
     if (_isPanningByMouseDrag)
     {
         HandlePanByStartAndStopPoint(mapcontrol, _startMousePoint, e.Location);
         _startMousePoint = e.Location;
     }
 }
예제 #25
0
 private void clearOpenedOpopup(IMapControl map)
 {
     if (currentPopupLayer != null)
     {
         RemoveControlFromMap(currentPopupLayer);
         currentPopupLayer = null;
     }
 }
예제 #26
0
 private void closePopups(IMapControl page)
 {
     foreach (var currentPopupLayer in openedPopupLayers)
     {
         RemoveControlFromMap(currentPopupLayer);
     }
     openedPopupLayers.Clear();
 }
예제 #27
0
 private async Task tryCreateStopLabelsAt(IMapControl page, GeoCoordinate currentLocation, IEnumerable <Stop> mandatoryStops = null)
 {
     if (!lowMarkedLocations.Any(loc => currentLocation.GetDistanceTo(loc) < App.Config.LowStopsRadius * 0.8))
     {
         lowMarkedLocations.Add(currentLocation);
         //highMarkedLocations.Add(currentLocation);
         await createStopLabelsAt(page, currentLocation, mandatoryStops, radius : App.Config.LowStopsRadius);
     }
 }
예제 #28
0
        public void Setup(IMapControl mapControl)
        {
            mapControl.Map = CreateMap();

            if (mapControl.Renderer is Rendering.Skia.MapRenderer && !mapControl.Renderer.StyleRenderers.ContainsKey(typeof(CustomStyle)))
            {
                mapControl.Renderer.StyleRenderers.Add(typeof(CustomStyle), new SkiaCustomStyleRenderer());
            }
        }
예제 #29
0
        private async void SetBoundaries(IMapControl map, LocationRectangle boundaries, bool noStopInParameter)
        {
            await Task.Delay(250);

            await initializeMapLabels(map);

            await map.TrySetViewBoundsAsync(boundaries, false);

            //while (page.ZoomLevel < 15)
            //{
            //    page.SetView(boundaries, MapAnimationKind.None);
            //    await Task.Delay(100);
            //}
            //while (page.IsMapEmpty)
            //{
            //    initializeMapLabels(page);
            //    await Task.Delay(100);
            //}

            map.CenterChanged += async(sender, args) =>
            {
                await mapFillingLock.WaitAsync();

                if (map.ZoomLevel >= App.Config.LowStopsMapLevel)
                {
                    await tryCreateStopLabelsAt(map, map.Center);
                }
                else if (map.ZoomLevel >= App.Config.HighStopsMapLevel)
                {
                    await tryCreateHighStopLabelsAt(map, map.Center);

                    clearMap(map, 2.1);
                }
                else
                {
                    clearMap(map);
                }
                mapFillingLock.Release();
            };

            if (isNear && noStopInParameter && mainPoints.Length == 0)
            {
                var nearestResult = await StopTransfers.GetNearestStop(CurrentLocation.Last);

                if (nearestResult != null)
                {
                    this.location   = CurrentLocation.Last;
                    this.mainPoints = nearestResult.Stop.Group.Stops.Select(s => s.Coordinate).ToArray();
                    var boundAddition = new GeoCoordinate[] { CurrentLocation.Last ?? App.Config.CenterLocation };

                    boundaries = calculateBoundaries(mainPoints.Concat(boundAddition));

                    await map.TrySetViewBoundsAsync(boundaries, false);
                    await initializeMapLabels(map);
                }
            }
        }
예제 #30
0
 protected override void MouseMove(IMapControl mapcontrol, MouseEventArgs e)
 {
     if (!_draging)
     {
         return;
     }
     _endPoint = e.Location;
     mapcontrol.Render();
 }
예제 #31
0
        public RelationshipContextMenu(IRelationshipProxy relationshipProxy, IMapControl map, INodeService service)
            : base()
        {
            RelationshipProxy = relationshipProxy;
            NodeService = service;
            Navigator = map.Navigator;

            this.Loaded += new RoutedEventHandler(NodeContextMenu_Loaded);
        }
예제 #32
0
        private void OnMapControlChanged(IMapControl oldMapControl, IMapControl newMapControl)
        {
            this.Items.Clear();

            // Monitor the map control so we can update the selected item.
            if (oldMapControl != null)
            {
                oldMapControl.NavigatorInitialised -= new EventHandler(MapControl_NavigatorInitialised);
            }
            if (newMapControl != null)
            {
                newMapControl.NavigatorInitialised += new EventHandler(MapControl_NavigatorInitialised);
            }
        }
예제 #33
0
        public NodeContextMenu(INodeProxy nodeProxy, IMapControl map, INodeService service, Point location)
            : base()
        {
            messageHandler = new EventHandler<MessageReceivedEventArgs>(map_MessageReceived);

            NodeProxy = nodeProxy;
            //MessageSender = map.MessageSender;
            Navigator = map.Navigator;
            NodeService = service;
            map.MessageReceived += messageHandler;
            MapControl = map;
            Location = location;

            this.Loaded += new RoutedEventHandler(NodeContextMenu_Loaded);
            this.Unloaded += new RoutedEventHandler(NodeContextMenu_Unloaded);
        }
        public DotDensityLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();
            this.myMap = myMap;
            this.dashboardHelper = dashboardHelper;
            this.mapControl = mapControl;

            provider = new DotDensityLayerProvider(myMap);

            FillComboBoxes();
            mapControl.MapDataChanged += new EventHandler(mapControl_MapDataChanged);
            btnShapeFile.Click += new RoutedEventHandler(btnShapeFile_Click);
            cbxDataKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxValue.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            rctDotColor.MouseUp += new MouseButtonEventHandler(rctDotColor_MouseUp);
            rctFilter.MouseUp += new MouseButtonEventHandler(rctFilter_MouseUp);
        }
        public ClusterLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();

            this.myMap = myMap;
            this.dashboardHelper = dashboardHelper;
            this.mapControl = mapControl;
            mapControl.TimeVariableSet += new TimeVariableSetHandler(mapControl_TimeVariableSet);
            mapControl.MapDataChanged += new EventHandler(mapControl_MapDataChanged);

            provider = new ClusterLayerProvider(myMap);
            provider.DateRangeDefined += new DateRangeDefinedHandler(provider_DateRangeDefined);
            provider.RecordSelected += new RecordSelectedHandler(provider_RecordSelected);
            cbxLatitude.SelectionChanged += new SelectionChangedEventHandler(coord_SelectionChanged);
            cbxLongitude.SelectionChanged += new SelectionChangedEventHandler(coord_SelectionChanged);
            rctColor.MouseUp += new MouseButtonEventHandler(rctColor_MouseUp);
            rctFilter.MouseUp += new MouseButtonEventHandler(rctFilter_MouseUp);

            FillComboBoxes();
        }
        public ChoroplethServerLayerProperties(ESRI.ArcGIS.Client.Map myMap, DashboardHelper dashboardHelper, IMapControl mapControl)
        {
            InitializeComponent();
            this.myMap = myMap;
            this.dashboardHelper = dashboardHelper;
            this.mapControl = mapControl;

            provider = new ChoroplethServerLayerProvider(myMap);
            provider.FeatureLoaded += new FeatureLoadedHandler(provider_FeatureLoaded);

            FillComboBoxes();
            mapControl.MapDataChanged += new EventHandler(mapControl_MapDataChanged);
            btnShapeFile.Click += new RoutedEventHandler(btnShapeFile_Click);
            cbxDataKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxShapeKey.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxValue.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            cbxClasses.SelectionChanged += new SelectionChangedEventHandler(keys_SelectionChanged);
            rctHighColor.MouseUp += new MouseButtonEventHandler(rctHighColor_MouseUp);
            rctLowColor.MouseUp += new MouseButtonEventHandler(rctLowColor_MouseUp);
            rctFilter.MouseUp += new MouseButtonEventHandler(rctFilter_MouseUp);
        }
예제 #37
0
 public PulverisationViewModel(IDataService dataService, IMapControl mapControl, List<BlocTBE> blocks)
 {
     _dataService = dataService;
     _mapControl = mapControl;
     _blocs = blocks;
 }
예제 #38
0
 public MessageViewModel(IDataService service, IMapControl mapControl)
 {
     _dataService = service;
     _mapControl = mapControl;
 }
예제 #39
0
파일: MapTool.cs 프로젝트: lishxi/_SharpMap
 public MapTool(MapControl mapControl)
 {
     this.mapControl = mapControl;
 }
예제 #40
0
        //Map Map { get; set; }

        public CoordinateConverter(IMapControl mapControl)
        {
            MapControl = mapControl;
        }
예제 #41
0
        private void AddNodeToMap(IMapControl map, Image item, MouseButtonEventArgs eventArgs)
        {
            TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance<TypeManager>();
            INodeTypeProxy nodeType = null;

            if (item.Name == "IdeaImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumIdeaNode");
            }
            else if (item.Name == "ProImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumProNode");
            }
            else if (item.Name == "ConImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumConNode");
            }
            else if (item.Name == "QuestionImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumQuestionNode");
            }
            else if (item.Name == "MapImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumMapNode");
            }
            else if (item.Name == "DecisionImage")
            {
                nodeType = typeManager.GetNodeType("CompendiumDecisionNode");
            }

            map.Navigator.AddNode(nodeType, "", eventArgs.GetPosition(map as UIElement));
        }
		public IList<IMapControlLayer> MapLayers(IMapControl mapControl) {
			MapControlLayer layer = MapControlLayer.Instance;
			layer.MapControl = mapControl;
			return new IMapControlLayer[] { layer };
        }
예제 #43
0
        //private void SystemPreferences_PropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    if (e.PropertyName == "RouteSettings.ShowGPSPoints" ||
        //        e.PropertyName == "RouteSettings.MarkerShape" ||
        //        e.PropertyName == "RouteSettings.MarkerSize" ||
        //        e.PropertyName == "RouteSettings.MarkerColor")
        //    {
        //        if (RouteControl.Visible)
        //        {
        //            RefreshOverlays();
        //        }
        //        else
        //        {
        //            routeSettingsChanged = true;
        //        }
        //    }
        //}

        //private void OnRouteItemsPropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    if (e.PropertyName == Activity.PropertyName.GPSRoute ||
        //        e.PropertyName == Route.PropertyName.GPSRoute ||
        //        e.PropertyName == Activity.PropertyName.Category )
        //    {
        //        ClearCachedLocations();
        //        RefreshOverlays();
        //    }
        //}

        private static MapIcon getCircle(IMapControl mapControl, float radius)
        {
            //Get pixel Size for icon - can differ X and Y
            //Calculate to radius, use point at apropriate distance to get meters->pixels
            const int circlePixelSize = 1000;
            IGPSPoint point0 = Utils.GPS.LocationToPoint(mapControl.MapProjection.PixelToGPS(mapControl.Center, mapControl.Zoom,
                new Point(0, 0)));
            IGPSPoint pointX = Utils.GPS.LocationToPoint(mapControl.MapProjection.PixelToGPS(mapControl.Center, mapControl.Zoom,
                new Point(circlePixelSize / 2, 0)));
            IGPSPoint pointY = Utils.GPS.LocationToPoint(mapControl.MapProjection.PixelToGPS(mapControl.Center, mapControl.Zoom,
                new Point(0, circlePixelSize / 2)));
            int sizeInPixelsX = (int)(circlePixelSize * radius / point0.DistanceMetersToPoint(pointX));
            int sizeInPixelsY = (int)(circlePixelSize * radius / point0.DistanceMetersToPoint(pointY));

            Size iconSize;
            string fileURL = TrailsPlugin.CommonIcons.Circle(sizeInPixelsX, sizeInPixelsY, out iconSize);
            return new MapIcon(fileURL, iconSize, new Point(iconSize.Width / 2, iconSize.Height / 2));
        }