示例#1
0
 public List<DistanceToSpecificOrt> CreateNearByList(Ort OrtToCalculateDistanceFrom)
 {
     if (OrtToCalculateDistanceFrom == null)
         return null;
     List<DistanceToSpecificOrt> Result = new List<DistanceToSpecificOrt>();
     foreach (Ort Entry in this.Collection)
     {
         DistanceToSpecificOrt Helper = new DistanceToSpecificOrt()
         {
             DistanceFromHere = OrtToCalculateDistanceFrom,
             DistanceToMe = Entry,
             Distance = ((Entry.WLaenge != null) && (Entry.WBreite != null)) ?
                     (int)CalculateDistanceFromGeoPoints
                 ((double)OrtToCalculateDistanceFrom.WBreite, (double)OrtToCalculateDistanceFrom.WLaenge,
                (double)Entry.WBreite, (double)Entry.WLaenge) : int.MaxValue
         };
         Result.Add(Helper);
     }
     return Result.OrderBy(Dist => Dist.Distance).ToList();
 }
		//public bool ImportData(String[] fileNamesToImport,
		//		Guid? foreignKeyToConnectTo = null,
		//		MaterialJPGForeignKeyConnectorenTyp foreignKeyTypToConnectTo = null)
		//	{
		//	List<MaterialJPG> NewMaterialJPGList = ImportData(fileNamesToImport,
		//		SelectedKoordinatenSource, SelectedMaterialJPGTyp, true,
		//		foreignKeyToConnectTo, foreignKeyTypToConnectTo);
		//	return (NewMaterialJPGList != null);
		//	}

		public List<MaterialJPG> ImportData(String[] fileNamesToImport, Ort selectedKoordinatenSource,
			MaterialJPGTyp selectedMaterialJPGTyp, bool showProgressUI, Guid? foreignKeyToConnectTo = null,
			MaterialJPGForeignKeyConnectorenTyp foreignKeyTypToConnectTo = null)
			{
			MaterialProgressDataModell ProgressModell = new MaterialProgressDataModell();
			Window ProgressWindow = new Window();
			if (showProgressUI)
				{
				ProgressModell = new MaterialProgressDataModell();
				ProgressModell.InsertProgressEntries(fileNamesToImport.ToList());
				ProgressWindow = new Window();
				ProgressWindow.Title = "ImportData gestarted";
				MaterialProgressView ProgressControl = new MaterialProgressView();
				ProgressControl.MaterialProgressDataModellInstance = ProgressModell;
				ProgressWindow.Content = ProgressControl;
				ProgressWindow.Show();
				}
			List<MaterialJPG> Result = new List<MaterialJPG>(); 
			ListOfFileNamesToImport = fileNamesToImport;
			int Index = 0;
			foreach (string fileNameToImport in ListOfFileNamesToImport)
				{
				if (showProgressUI)
					ProgressModell.SetStatus(Index, "Gestarted");
				MaterialJPG newMaterialRow = Data.DbServer3.Blob.MaterialienJPG.NewRow();
				newMaterialRow.Id = Guid.NewGuid();
				newMaterialRow.FullFileNameToLoadFrom = fileNameToImport.ToLower();
				FileInfo fileInfo = new FileInfo(fileNameToImport);

				newMaterialRow.Value = fileInfo.LoadAs_ByteArray();
				newMaterialRow.HashCode = newMaterialRow.Value.Sha1Hash().ConvertTo_Hex();
				newMaterialRow.ValueThumb = newMaterialRow.Value.ConvertTo_Image()
					.ResizeToMaximum(300, 200).ConvertTo_JpgByteArray(80);

				MaterialJPG[] EqualEntries = Data.DbServer3.Blob.MaterialienJPG.Load_AllForHashCode(newMaterialRow.HashCode);
				if (EqualEntries.Length > 0)
					{
					//MessageBox.Show("Es gibt einen Eintrag mit gleichem HashCode\r\n" +
					//                "gespeichert ist derzeit der File:\r\n\""
					//                + EqualEntries[0].FullFileNameToLoadFrom + "\"\r\n" +
					//                "der folgende File soll importiert werden:\r\n\"" +
					//                newMaterialRow.FullFileNameToLoadFrom + "\"\r\n" +
					//                "Dieser Eintrag wird übersprungen!!");
					if (showProgressUI)
						{
						ProgressModell.SetStatus(Index++, "Eintrag schon vorhanden");
						}

					Result.Add(EqualEntries[0]);
					continue;
					}
				newMaterialRow.LastWriteFileTime = fileInfo.LastWriteTime;
				newMaterialRow.TypId = selectedMaterialJPGTyp.Id;
				newMaterialRow.WLaengeOrt = selectedKoordinatenSource.WLaenge;
				newMaterialRow.WBreiteOrt = selectedKoordinatenSource.WBreite;
				String NamePart = Path.GetFileName(Path.GetDirectoryName(fileNameToImport)) + "\\"
				                  + Path.GetFileName(fileNameToImport);
				newMaterialRow.NameId = "Ort_" + fileInfo.LastWriteTime.ToString("yyyy-MM-dd_HH_mm") + "_" + NamePart;
				newMaterialRow.Description = "Ort_" + selectedKoordinatenSource.Bezeichnung;
				newMaterialRow.LastLoadTime = DateTime.Now;
				newMaterialRow.PictureTakenDateTime = fileInfo.LastWriteTime;
				Data.DbServer3.Blob.MaterialienJPG.Rows.Add(newMaterialRow);
				Data.DbServer3.Blob.SaveAnabolic(true);
				newMaterialRow.Value = null;
				Data.DbServer3.Blob.AcceptChanges();
				if (showProgressUI)
					ProgressModell.SetStatus(Index++, "Eintrag gespeichert");
				Result.Add(newMaterialRow);
				}
			if ((foreignKeyToConnectTo != null)
			    && (foreignKeyTypToConnectTo != null))
				{
				if (showProgressUI)
					{
					ProgressModell.CompletionStatus = "Bilder registriert";
					ProgressWindow.Title = "ImportData fertig, Die Daten werden jetzt verknüpft";
					}
				Index = 0;
				foreach (MaterialJPG materialJPG in Result)
					{
					MaterialJPGForeignKeyConnector foreignConnector
						= Data.DbServer3.Blob.MaterialJPGForeignKeyConnectoren.NewRow();
					foreignConnector.Id = Guid.NewGuid();
					foreignConnector.Description = materialJPG.Description;
					foreignConnector.ForeignId = foreignKeyToConnectTo;
					foreignConnector.JPGId = materialJPG.Id;
					foreignConnector.TypId = foreignKeyTypToConnectTo.Id;
					Data.DbServer3.Blob.MaterialJPGForeignKeyConnectoren.Rows.Add(foreignConnector);
					Data.DbServer3.Blob.SaveAnabolic();
					Data.DbServer3.Blob.AcceptChanges();
					if (showProgressUI)
						ProgressModell.SetStatus(Index++, "Eintrag verknüpft");
					}
				}
			if (showProgressUI)
				{
				ProgressModell.CompletionStatus = "Fertig";
				ProgressWindow.Title = "ImportData komplett fertig, Sie können dieses Fenster jetzt schließen";
				}
			return Result;
			}
示例#3
0
		public StatistikRootClass(Ort ort)
			{
			OrtDaten = ort;
			}
		public PictureContainerList(DbServer3Context parent, Projekt connectedProjekt,
					Ort connectedOrt, Guid materialienTyp, bool alwaysReload = false)
			{
			Parent = parent;
			MaterialienTyp = materialienTyp;
			ConnectedProjekt = connectedProjekt;
			ConnectedOrt = connectedOrt;
			AlwaysReload = alwaysReload;
			}
		public static List<PictureContainerList> PrepareData(DbServer3Context parent, Projekt connectedProjekt,
					Ort connectedOrt, bool isOrtOrProjekt, bool? shortList = null, bool alwaysReload = false)
			{
			List<PictureContainerList> result = new List<PictureContainerList>();
			if (isOrtOrProjekt)
				{
				if ((shortList == null)
				    || (bool) (shortList))
					{
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.Ueberblick, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.LagePlan, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.LuftBild, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.Ort, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					}
				if ((shortList == null)
				    || (!(bool) shortList))
					{
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBild, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					}
				}
			else
				{
				if ((shortList == null)
				    || ((bool) shortList))
					{

					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.PPTBild, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.SymbolBild, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBildBefore, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBild, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBildAfter, alwaysReload)
						{
						IsOrtOrProjekt = false
						});

					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.Ueberblick, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.LagePlan, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.LuftBild, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.Ort, alwaysReload)
						{
						IsOrtOrProjekt = true
						});
					}
				else
					{
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBildBefore, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBild, alwaysReload)
						{
						IsOrtOrProjekt = false
						});
					result.Add(new PictureContainerList(parent, connectedProjekt, connectedOrt,
						MaterialienTypen.ProjektBildAfter, alwaysReload)
						{
						IsOrtOrProjekt = false
						});

					}
				}
			return result;
			}
示例#6
0
		public MapAdditionalInfo(Ort ort, int ortsIDNumber)
			{
			OrtToDraw = ort;
			OrtsIDNumber = ortsIDNumber;
			}
 private void StartUpOrtChanged(Ort OldValue,
     Ort NewValue)
     {
     if (NewValue != null)
         {
         IntelligenceProjekteDataModelInstance.SelectedOrt = NewValue;
         }
     }
示例#8
0
		Point GetProjectPosition (Ort ortsEntry, Rect OutsideDrawingRect)
			{
			double XKoordinate = Convert.ToDouble (ortsEntry.WLaenge);
			double YKoordinate = Convert.ToDouble (ortsEntry.WBreite);

			double XPercentage = GetRelativLiesingBreite (XKoordinate);
			double YPercentage = GetRelativLiesingLaenge (YKoordinate);

			if ((XPercentage > 100)
				|| (XPercentage < 0)
				|| (YPercentage > 100)
				|| (YPercentage < 0))
				{
				MessageBox.Show ("Die Koordinaten für \"" + ortsEntry.Bezeichnung + "\" sind falsch");
				XPercentage = 0.5;
				YPercentage = 0.5;
				}

			double XValue = OutsideDrawingRect.Width * XPercentage;
			double YValue = OutsideDrawingRect.Height * YPercentage;
			return new Point (XValue, YValue);
			}
示例#9
0
		private DbEntities.dbserver3.wordup.rows.Ort[] GetOrteToDraw(out DbEntities.dbserver3.wordup.rows.Projekt[] Projekte,
			TypeOfPictureToDraw PictureToDraw)
			{
			DbEntities.dbserver3.wordup.rows.Ort[] Result = new Ort[0];
			Projekte = new Projekt[0];
			switch (PictureToDraw)
				{
					case TypeOfPictureToDraw.AllActuallExistingOrte:
					case TypeOfPictureToDraw.AllActuallWuensche:
						Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Wuensche");
						Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray();
						break;
					case TypeOfPictureToDraw.AllActuallWuenscheNotFinish:
						Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Wuensche")
							.Where(sel => sel.Ort.WLaenge == null).ToArray();
						Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray();
						break;
					case TypeOfPictureToDraw.AllActualPlanungen:
						Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Planungen");
						Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray();
						break;
					case TypeOfPictureToDraw.AllActuallPlanungenNotFinish:
						Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Planungen")
							.Where(sel => sel.Ort.WLaenge == null
							              || sel.PPTBilder.Count == 0).ToArray();
						Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray();
						break;
				}
			return Result;
			}
示例#10
0
		//void FillOrteListe ()
		//	{
		//	AllOrteListBox.Items.Clear ();
		//	foreach (DataRow OrteRow in MapDataWrapper.Instance.AllWordUpOrte.Rows)
		//		{
		//		ListViewItem Entry = new ListViewItem ();
		//		Entry.Content = OrteRow ["NameID"].ToString () + " - " + OrteRow ["Beschreibung"].ToString ();
		//		Entry.Tag = OrteRow;
		//		AllOrteListBox.Items.Add (Entry);
		//		}
		//	}


		BitmapSource RunLagePlanCreation (Ort OrtsEntry)
			{
			if ((OrtsEntry.WBreite == double.NaN)
				|| (OrtsEntry.WLaenge == double.NaN))
				return null;

			Grid FramingGrid = LagePlanImage.Parent as Grid;
			FramingGrid.UpdateLayout();
			double ActualGridEntryHeight = FramingGrid.RowDefinitions[1].ActualHeight * 2;
			double ActualGridEntryWidth = FramingGrid.ColumnDefinitions[0].ActualWidth * 2;

			LagePlanImage.Source = MapBasics.Instance.CreateOSMPictureWithOverLoadsViaMeasurement
						(Convert.ToDouble (OrtsEntry.WLaenge),
			            Convert.ToDouble (OrtsEntry.WBreite),
			            (int) ActualGridEntryWidth, (int) ActualGridEntryHeight, 5);
			//LagePlanImage.Source = MapDataWrapper.Instance.GetLagePlan (Convert.ToDouble (OrtsEntry ["WLaenge"]),
			//															Convert.ToDouble (OrtsEntry ["WBreite"]));
			if (LagePlanImage.Source == null)
				{
//				UsedKachelTextBox.Text = "Not Fitted";
				return null;
				}
			WMB.Basics.DoEvents ();
			return LagePlanImage.Source as BitmapSource;
			}
        private void OrtInstanceChanged(Ort OldValue,
            Ort NewValue)
            {
            IntelligenceOrteDataModelInstance.HandleOrteNearBySorted(NewValue);

            }
 public void UseSelectedOrt()
     {
     OrtInstance = IntelligenceOrteDataModelInstance.SelectedOrt;
     if (OrtInstance != null)
         IntelligenceOrteDataModelInstance.AddUsedEntry(OrtInstance);
     }
		public Ort ClearSelectedOrt()
            {
            OrtInstance = IntelligenceOrteDataModelInstance.SelectedOrt = null;
            return null;
            }
示例#14
0
		public OrtsCounter(Ort ort, OrtsTeilCounter ortsTeilCounterParent)
			: base (ort)
			{
			Parent = ortsTeilCounterParent;
			}