Пример #1
0
		void DrawOrtsEntry (DrawingContext BoardContext, double Width, Rect OutsideDrawingRect,
			MapAdditionalInfo mapAdditionalInfoEntry)
			{
			double emSize = Width / 75;
			Brush TextBrush = (Brush) BRConverter.ConvertFromString ("black");

			Typeface DefaultTypeface = new Typeface (new FontFamily ("Arial"), FontStyles.Normal,
				 FontWeights.Bold, FontStretches.Normal, new FontFamily (("Arial")));
			String Input = $"{mapAdditionalInfoEntry.OrtsIDNumber}";
			FormattedText TextToDisplay =
				new FormattedText (Input,
					CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, DefaultTypeface, emSize, TextBrush);

			Point ProjectPosition = GetProjectPosition (mapAdditionalInfoEntry.OrtToDraw, OutsideDrawingRect);
			Point TextPosition = new Point (ProjectPosition.X - 5, ProjectPosition.Y - 3);
			BoardContext.DrawText (TextToDisplay, TextPosition);
			Point SpritePosition = new Point (ProjectPosition.X, ProjectPosition.Y - 28);
			BitmapSource ActuallFaehnlein = null;
			String Ortsteil = mapAdditionalInfoEntry.OrtToDraw.OrtsTeil.NameId;
			if (Ortsteil == "Erlaa")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Erlaa;
			if (Ortsteil == "Atzgersdorf")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Atzgersdorf;
			if (Ortsteil == "Inzersdorf")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Inzersdorf;
			if (Ortsteil == "Liesing")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Liesing;
			if (Ortsteil == "Mauer")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Mauer;
			if (Ortsteil == "Rodaun")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Rodaun;
			if (Ortsteil == "Siebenhirten")
				ActuallFaehnlein = MapDataWrapper.Instance.Faehnlein_Siebenhirten;

			BoardContext.DrawImage (ActuallFaehnlein, new Rect (SpritePosition, new Size (20, 28)));
			}
Пример #2
0
		public void CreateLagePlanBilder (String TargetDirectory, TypeOfPictureToDraw PictureToDraw)
			{

			DrawingVisual DrawingBoard = new DrawingVisual ();
			DrawingContext BoardContext = DrawingBoard.RenderOpen ();
			double AspectRatio = LiesingHorizontalExtent / LiesingVerticalExtent;
			double Width = 1280;
			double Height = Width / AspectRatio;
			Rect OutsideDrawingRect = new Rect (0, 0, Width, Height);
			DrawBackGroundPicture (BoardContext,
					OutsideDrawingRect, Path.Combine (TargetDirectory, Properties.Settings.Default.LiesingPicture));
			Projekt[] ProjecteToDraw = null;
			DbEntities.dbserver3.wordup.rows.Ort[] OrteToDraw = GetOrteToDraw (out ProjecteToDraw, PictureToDraw);
			int OrtsNumber = 0;
			List<MapAdditionalInfo> mapAdditionalInfos = new List<MapAdditionalInfo> ();
			int OrteIDNumber = 0;
			foreach (Ort OrtToDraw in OrteToDraw)
				{
				OrteIDNumber++;
				MapAdditionalInfo mapAdditionalInfoEntry = new MapAdditionalInfo(OrtToDraw, OrteIDNumber);
				mapAdditionalInfos.Add(mapAdditionalInfoEntry);
                mapAdditionalInfoEntry.ProjekteOnThisOrt = ProjecteToDraw.Where(sel => sel.Ort == OrtToDraw).ToArray();
				DrawOrtsEntry (BoardContext, Width, OutsideDrawingRect, mapAdditionalInfoEntry);

/*
				DataTable Projekte = null;
				switch (PictureToDraw)
					{
					case TypeOfPictureToDraw.AllActuallWuensche:
						Projekte = WordUpWCFAccess.GetCommonDataSet
							("Select * from ProjektUebersicht where WordUpRootID = '" + WordUpID
							 + "' and OrteID = '" + OrtsID + "'").Tables ["ProjektUebersicht"];
						MapAdditionalInfo.Add (mapAdditionalInfoEntry);
						AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte);
						CreateDrawingLegende (TargetDirectory, ProjecteToDraw);
						break;
					case TypeOfPictureToDraw.AllActuallWuenscheNotFinish:
						Projekte = WordUpWCFAccess.GetCommonDataSet
							("Select * from ProjektUebersicht where WordUpRootID = '" + WordUpID
							 + "' and OrteID = '" + OrtsID + "' and ((DokumentationsStatus is null) or (DokumentationsStatus = '') "
							 + "or (not DokumentationsStatus = 'Video;Bild')) and Zustaendig = 'Bezirk'")
							.Tables ["ProjektUebersicht"];
						MapAdditionalInfo.Add (mapAdditionalInfoEntry);
						AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte);
						CreateDrawingLegende (TargetDirectory, ProjecteToDraw);
						break;
					case TypeOfPictureToDraw.AllActuallExistingOrte:
						Projekte = WordUpWCFAccess.GetCommonDataSet
							("Select * from ProjektUebersicht where OrteID = '" + OrtsID + "'").Tables ["ProjektUebersicht"];
						MapAdditionalInfo.Add (mapAdditionalInfoEntry);
						AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte);
						CreateDrawingLegende (TargetDirectory, ProjecteToDraw);
						break;
					}

*/	
				}
			BoardContext.Close ();
			RenderTargetBitmap DrawingBitmap = new RenderTargetBitmap
				((int) (Width * XDPIFactor), (int) (Height * YDPIFactor),
				XDPIFactor * 96, YDPIFactor * 96, PixelFormats.Pbgra32);
			DrawingBitmap.Render (DrawingBoard);
			if (DrawingBoard.Drawing == null)
				return;
			Rect OriginalRect = DrawingBoard.Drawing.Bounds;
			ImageBrush IMBrush = new ImageBrush ();
			IMBrush.ImageSource = (BitmapSource) BitmapFrame.Create (DrawingBitmap);
			IMBrush.Stretch = Stretch.Uniform;
			IMBrush.AlignmentY = AlignmentY.Top;
			LagePlanWindow = new Window ();
			LagePlanWindow.Width = DrawingBoard.Drawing.Bounds.Width;
			LagePlanWindow.Height = DrawingBoard.Drawing.Bounds.Height + 25;
			LagePlanWindow.Background = IMBrush;
			LagePlanWindow.Title = "WordUp Projekt Orte";
			LagePlanWindow.ContextMenuOpening += new ContextMenuEventHandler (LagePlanWindow_ContextMenuOpening);
			LagePlanWindow.Tag = mapAdditionalInfos;
			LagePlanWindow.Show ();
			}