示例#1
0
 private void MapControlInstance_OverlayElementSelectedHandler(object Sender, EntityInfo SelectedObject)
     {
     if (SelectedObject.ChangedButton == MouseButton.Left)
         {
         Popup ObjectDescriptionWindow = new Popup();
         ObjectDescriptionWindow.StaysOpen = false;
         ObjectDescriptionWindow.Placement = PlacementMode.Mouse;
         if (SelectedObject.Type == MapBasics.EntityType.TypeIsMarker)
             {
             CreateMarkerDescription(ObjectDescriptionWindow, SelectedObject);
             }
         ObjectDescriptionWindow.IsOpen = true;
         }
     }
示例#2
0
 public bool Equals(EntityInfo e2)
     {
     if (this.Type != e2.Type)
         return false;
     switch (this.Type)
         {
             case MapBasics.EntityType.TypeIsLatLon:
                 if (Lat != e2.Lat || Lon != e2.Lon)
                     return false;
                 break;
             case MapBasics.EntityType.TypeIsMarker:
                 if (Marker != e2.Marker)
                     return false;
                 break;
             case MapBasics.EntityType.TypeIsTrackPoint:
                 if (DrawAbleTrack != e2.DrawAbleTrack)
                     return false;
                 break;
             default:
                 throw new ApplicationException("Unsupported entity type");
         }
     return true;
     }
示例#3
0
 private void CreateMarkerDescription(Popup Parent, EntityInfo SelectedMarkerInfo)
     {
     String HeadLineText = String.Empty;
     String DescriptionText = String.Empty;
     switch (SelectedMarkerInfo.Marker.TypeToDraw)
         {
             case LogicalAreaType.Schule:
                 {
                 // OrganisationenMitOrte
                 HeadLineText = (SelectedMarkerInfo.Marker.Tag as DataRow)["NameID"].ToString();
                 DescriptionText = CreateSchulDescription((SelectedMarkerInfo.Marker.Tag as DataRow));
                 break;
                 }
             case LogicalAreaType.Schueler:
                 {
                 HeadLineText = (SelectedMarkerInfo.Marker.Tag as DataRow)["NameID"].ToString();
                 DescriptionText = CreateSchuelerDescription((SelectedMarkerInfo.Marker.Tag as DataRow));
                 break;
                 }
             case LogicalAreaType.SchuelerM:
                 {
                 HeadLineText = "Herr " + (SelectedMarkerInfo.Marker.Tag as DataRow)["NameID"].ToString();
                 DescriptionText = CreateSchuelerDescription((SelectedMarkerInfo.Marker.Tag as DataRow));
                 break;
                 }
             case LogicalAreaType.SchuelerW:
                 {
                 HeadLineText = "Frau " + (SelectedMarkerInfo.Marker.Tag as DataRow)["NameID"].ToString();
                 DescriptionText = CreateSchuelerDescription((SelectedMarkerInfo.Marker.Tag as DataRow));
                 break;
                 }
             case LogicalAreaType.Wunsch:
                 {
                 break;
                 }
             case LogicalAreaType.Planung:
                 {
                 break;
                 }
             case LogicalAreaType.Projekt:
                 {
                 break;
                 }
             case LogicalAreaType.Realisierung:
                 {
                 break;
                 }
             case LogicalAreaType.MissingProjektPicture:
                 {
                 break;
                 }
             case LogicalAreaType.MissingOrtPicture:
                 {
                 break;
                 }
         }
     StackPanel InfoPanel = new StackPanel();
     InfoPanel.Orientation = Orientation.Vertical;
     Parent.Child = InfoPanel;
     InfoPanel.Children.Add(new TextBlock()
         {
         Text = SelectedMarkerInfo.Marker.TypeToDraw.ToString(),
         Background = Brushes.White
         });
     InfoPanel.Children.Add(new TextBlock()
         {
         Text = HeadLineText,
         FontWeight = FontWeights.Bold,
         Background = Brushes.White
         });
     InfoPanel.Children.Add(new TextBlock() {Text = DescriptionText, Background = Brushes.White});
     }
示例#4
0
		private bool LocationClicked (EntityInfo SelectedEntityInfo, bool LeftOrRight)
			{
			if (MapWindowInstance.ActuallMouseBehavioir == MapBasics.MouseUsage.ChangeCenterAndMarkerWithNextClick)
				{
				Marker LocationMarker;
				if (Markers.Count > 0)
					{
					LocationMarker = Markers [0];
					}
				else
					{
					LocationMarker = new Marker ();
					Markers.Add (LocationMarker);
					}
				LocationMarker.Lat = SelectedEntityInfo.Lat;
				LocationMarker.Lon = SelectedEntityInfo.Lon;
				Latitude = SelectedEntityInfo.Lat;
				Longitude = SelectedEntityInfo.Lon;
				StdMouseFunktion.IsChecked = true;
				StdMouseFunktion_OnClick(null, null);
				if (NewLocationSetHandler != null)
					NewLocationSetHandler(SelectedEntityInfo.Lat, SelectedEntityInfo.Lon);
				return true;
				}
			if (MapWindowInstance.ActuallMouseBehavioir == MapBasics.MouseUsage.DefineMarkerAtClickedPosition)
				{
				if (LeftOrRight)
					{
					Marker LocationMarker = new Marker ();
					Markers.Add (LocationMarker);
					LocationMarker.TypeToDraw = LogicalAreaType.Error;
					LocationMarker.Lat = SelectedEntityInfo.Lat;
					LocationMarker.Lon = SelectedEntityInfo.Lon;
					Latitude = SelectedEntityInfo.Lat;
					Longitude = SelectedEntityInfo.Lon;
					return true;
					}
				else
					{
					Markers.Remove (SelectedEntityInfo.Marker);
					return true;
					}
				}
			if (MapWindowInstance.ActuallMouseBehavioir == MapBasics.MouseUsage.DefineRegionOfInterests)
				{
				}
			return false;
			}
示例#5
0
	    void MapWindowInstance_OverlayElementSelectedHandler(object Sender, EntityInfo SelectedObject)
			{
			if (OverlayElementSelectedHandler != null)
				OverlayElementSelectedHandler (Sender, SelectedObject);
			}
示例#6
0
		private void RootImage_OnMouseMove(object Sender, MouseEventArgs E)
			{

			if (mMouseMoving)
				{
				int movedx = (int)E.GetPosition(this).X - mMouseMovingFromX;
				int movedy = (int)E.GetPosition(this).Y - mMouseMovingFromY;
				if (ActuallMouseBehavioir == MapBasics.MouseUsage.DefaultMouseBehavioir)
					{
					if (movedx != 0 || movedy != 0)
						{
						Latitude += LonScale * movedy;
						Longitude -= LonScale * movedx;
						MapBasic.CalcGeometry (GeoInfo, RenderSize.Width, RenderSize.Height, Longitude, Latitude, LonScale);
						GeoInfo.RedrawRequired = true;
						RaiseViewChanged ();
						}
					}
				if (ActuallMouseBehavioir == MapBasics.MouseUsage.DefineRegionOfInterests)
					{
					if (ActuallROIRectangle.Size == new Size (0, 0))
						{
						ActuallROIRectangle = new Rect(mMouseMovingFromX, mMouseMovingFromY,
							E.GetPosition(this).X, E.GetPosition(this).Y);
						}
					else
						{
						if ((E.GetPosition (this).X < ActuallROIRectangle.Left)
						    || (E.GetPosition (this).Y < ActuallROIRectangle.Top))
							{
							ActuallROIRectangle = new Rect (0, 0, 0, 0);
							ActuallMouseBehavioir = MapBasics.MouseUsage.DefaultMouseBehavioir;
							if (ResetMouseFunctionsHandler != null)
								ResetMouseFunctionsHandler (this);
							return;
							}
						ActuallROIRectangle.Size = new Size (Math.Abs (E.GetPosition (this).X - ActuallROIRectangle.Left),
						                                     Math.Abs (E.GetPosition (this).Y - ActuallROIRectangle.Top));
						}
					GeoInfo.RedrawRequired = true;
					RaiseViewChanged();
					}
				mMouseMovingFromX = (int)E.GetPosition(this).X;
				mMouseMovingFromY = (int)E.GetPosition(this).Y;
				}
			else
				{
				if (mHighlightEntities)
					{
					EntityInfo ei = MapBasic.GetEntityAtClientPos(GeoInfo, (int)E.GetPosition(this).X, (int)E.GetPosition(this).Y,
						Markers, Tracks, ActuallMouseBehavioir);
					EntityInfo newh;
					if (ei.Type == MapBasics.EntityType.TypeIsMarker || ei.Type == MapBasics.EntityType.TypeIsTrackPoint)
						{
						newh = ei;
						}
					else
						{
						newh = null;
						}
					if (mHighlightedEntity == null)
						{
						if (newh != null)
							{
							mHighlightedEntity = newh;
							GeoInfo.RedrawRequired = true;
							}
						}
					else
						{
						if (newh == null)
							{
							mHighlightedEntity = null;
							GeoInfo.RedrawRequired = true;
							}
						else
							{
							if (!newh.Equals(mHighlightedEntity))
								{
								mHighlightedEntity = newh;
								GeoInfo.RedrawRequired = true;
								}
							}
						}
					}
				}
			}
示例#7
0
		public void StartRedraw()
			{
			mMouseMoving = false;
			mHighlightedEntity = null;
			GeoInfo.RedrawRequired = true;
			}
示例#8
0
        /// <summary>
        /// Get the 'entity' at the given client position.
        /// </summary>
        /// <param name="x">The client X position.</param>
        /// <param name="y">The client Y position.</param>
        /// <returns>An EntityInfo instance describing the entity.</returns>
        public EntityInfo GetEntityAtClientPos(GeometryInfo GeoInfo, int x, int y, List<Marker> mMarkers,
            List<DrawAbleTrack> mTracks, MouseUsage ActuallMouseBehavioir)
            {
            EntityInfo SelectedEntityInfo = new EntityInfo();
            SelectedEntityInfo.ActuallMouseBehavioir = ActuallMouseBehavioir;
            ClientPosToLatLon(GeoInfo, x, y, out SelectedEntityInfo.Lat, out SelectedEntityInfo.Lon);
            double Difference = GeoInfo.Scale*50;
//			Difference = 0.001;
            if ((ActuallMouseBehavioir == MouseUsage.DefaultMouseBehavioir)
                || (ActuallMouseBehavioir == MouseUsage.ChangeCenterAndMarkerWithNextClick)
                || (ActuallMouseBehavioir == MouseUsage.DefineMarkerAtClickedPosition))
                foreach (Marker StoredMarkers in mMarkers)
                    {
                    if ((Math.Abs(SelectedEntityInfo.Lat - StoredMarkers.Lat) < Difference)
                        && (Math.Abs(SelectedEntityInfo.Lon - StoredMarkers.Lon) < Difference))
                        {
                        SelectedEntityInfo.Marker = StoredMarkers;
                        SelectedEntityInfo.Type = EntityType.TypeIsMarker;
                        return SelectedEntityInfo;
                        }
                    }
            if (ActuallMouseBehavioir == MouseUsage.DefaultMouseBehavioir)
                foreach (DrawAbleTrack StoredTracks in mTracks)
                    {
                    foreach (TrackPoint PointInStoredTrack	 in StoredTracks.Points)
                        {
                        if ((Math.Abs(SelectedEntityInfo.Lat - PointInStoredTrack.Lat) < Difference)
                            && (Math.Abs(SelectedEntityInfo.Lon - PointInStoredTrack.Lon) < Difference))
                            {
                            SelectedEntityInfo.DrawAbleTrack = StoredTracks;
                            SelectedEntityInfo.Time = PointInStoredTrack.Time;
                            SelectedEntityInfo.Type = EntityType.TypeIsTrackPoint;
                            return SelectedEntityInfo;
                            }
                        }
                    }

            ClientPosToLatLon(GeoInfo, x, y, out SelectedEntityInfo.Lat, out SelectedEntityInfo.Lon);
            SelectedEntityInfo.Type = EntityType.TypeIsLatLon;
            return SelectedEntityInfo;
            }
示例#9
0
 public void FillDrawingHighLightning(GeometryInfo GeoInfo, DrawingContext Context, EntityInfo mHighlightedEntity)
     {
     try
         {
         // Highlight something if necessary...
         if (mHighlightedEntity != null)
             {
             Pen pen;
             int mx, my;
             switch (mHighlightedEntity.Type)
                 {
                     case EntityType.TypeIsMarker:
                         pen = new Pen(Brushes.Blue, 3);
                         LatLonToClientPos(GeoInfo, mHighlightedEntity.Marker.Lat, mHighlightedEntity.Marker.Lon,
                             out mx, out my);
                         Context.DrawEllipse(null, pen, new Point(mx - 6, my - 6), 13, 13);
                         break;
                     case EntityType.TypeIsTrackPoint:
                         pen = new Pen(Brushes.Orange, 2);
                         foreach (TrackPoint tp in mHighlightedEntity.DrawAbleTrack.Points)
                             {
                             if (tp.Time == mHighlightedEntity.Time)
                                 {
                                 LatLonToClientPos(GeoInfo, tp.Lat, tp.Lon, out mx, out my);
                                 Context.DrawEllipse(null, pen, new Point(mx - 4, my - 4), 9, 9);
                                 }
                             }
                         break;
                 }
             }
         }
     catch (Exception Excp)
         {
         MessageBox.Show("Drawing Exception: " + Excp.ToString());
         }
     }