private Measurement(int entityId, string entityType, FrmGlobespotter frmGlobespotter, bool drawPoint) { _entityId = entityId; _frmGlobespotter = frmGlobespotter; DrawPoint = drawPoint; switch (entityType) { case "pointMeasurement": _typeOfLayer = TypeOfLayer.Point; break; case "surfaceMeasurement": _typeOfLayer = TypeOfLayer.Polygon; break; case "lineMeasurement": _typeOfLayer = TypeOfLayer.Line; break; default: _typeOfLayer = TypeOfLayer.None; break; } }
protected override void OnMouseUp(MouseEventArgs arg) { try { CycloMediaLayer layer; string imageId = GetImageIdFromPoint(arg, out layer); if ((!string.IsNullOrEmpty(imageId)) && (layer != null)) { IMappedFeature mappedFeature = layer.GetLocationInfo(imageId); var recording = mappedFeature as Recording; if (recording != null) { if ((recording.IsAuthorized == null) || ((bool)recording.IsAuthorized)) { FrmGlobespotter.ShowLocation(imageId, layer); } else { MessageBox.Show(Resources.GsOpenLocation_OnMouseUp_You_are_not_authorized_to_view_the_image_); } } } } catch (Exception ex) { _logClient.Error("GsOpenLocation.OnMouseUp", ex.Message, ex); Trace.WriteLine(ex.Message, "GsOpenLocation.OnMouseUp"); } base.OnMouseUp(arg); }
public void AddToGlobespotter(string name, int minZoomLevel, bool useProxy, Color color) { _name = name; MinZoomLevel = minZoomLevel; UseProxy = useProxy; Color = color; FrmGlobespotter.AddWfsLayer(this); AddToLayers(); }
private void Afterdraw(IDisplay display, esriViewDrawPhase drawPhase) { if (drawPhase == esriViewDrawPhase.esriViewForeground) { if (CycloMediaGroupLayer != null) { FrmCycloMediaOptions.OpenIfNoCredentials(); FrmGlobespotter.CheckVisible(); } } }
public static void Clear(FrmGlobespotter globespotter) { foreach (var viewer in Viewers) { uint viewerId = viewer.Key; globespotter.CloseViewer(viewerId); Viewer myViewer = viewer.Value; myViewer.Dispose(); } Viewers.Clear(); }
public void RemoveLayers() { if (CycloMediaGroupLayer != null) { GsShowInCyclorama.RemoveFromMenu(); FrmCycloMediaOptions.CloseForm(); FrmMeasurement.Close(); FrmIdentify.Close(); CycloMediaGroupLayer cycloLayer = CycloMediaGroupLayer; CycloMediaGroupLayer = null; cycloLayer.Dispose(); FrmGlobespotter.ShutDown(true); } }
protected override void Dispose(bool disposing) { FrmGlobespotter.DisposeFrm(disposing); base.Dispose(disposing); }
protected override void PostEntryStep() { const string objectId = "RecordedAt"; const string object2Id = "PIP"; const string object3Id = "IsAuthorized"; IActiveView activeView = ArcUtils.ActiveView; IEnvelope envelope = activeView.Extent; ISpatialFilter spatialFilter = new SpatialFilterClass { Geometry = envelope, GeometryField = FeatureClass.ShapeFieldName, SpatialRel = esriSpatialRelEnum.esriSpatialRelContains, SubFields = string.Format("{0},{1},{2}", objectId, object2Id, object3Id) }; var existsResult = FeatureClass.Search(spatialFilter, false); IFeature feature; var added = new List <int>(); var pipAdded = new List <int>(); var forbiddenAdded = new List <int>(); while ((feature = existsResult.NextFeature()) != null) { // ReSharper disable UseIndexedProperty int imId = existsResult.FindField(objectId); object value = feature.get_Value(imId); var dateTime = (DateTime)value; int year = dateTime.Year; if (!YearToColor.ContainsKey(year)) { YearToColor.Add(year, Color.Transparent); added.Add(year); } int pipId = existsResult.FindField(object2Id); object pipValue = feature.get_Value(pipId); if (pipValue != null) { bool pip = bool.Parse((string)pipValue); if (pip && (!YearPip.Contains(year))) { YearPip.Add(year); pipAdded.Add(year); } } int forbiddenId = existsResult.FindField(object3Id); object forbiddenValue = feature.get_Value(forbiddenId); // ReSharper restore UseIndexedProperty if (forbiddenValue != null) { bool forbidden = !bool.Parse((string)forbiddenValue); if (forbidden && (!YearForbidden.Contains(year))) { YearForbidden.Add(year); forbiddenAdded.Add(year); } } } var geoFeatureLayer = Layer as IGeoFeatureLayer; if (geoFeatureLayer != null) { IFeatureRenderer featureRenderer = geoFeatureLayer.Renderer; var uniqueValueRenderer = featureRenderer as IUniqueValueRenderer; if (uniqueValueRenderer != null) { foreach (var value in added) { // ReSharper disable CSharpWarnings::CS0612 // ReSharper disable CSharpWarnings::CS0618 var symbol = new SimpleMarkerSymbol { Color = Converter.ToRGBColor(Color.Transparent), Size = SizeLayer }; // ReSharper restore CSharpWarnings::CS0618 // ReSharper restore CSharpWarnings::CS0612 var markerSymbol = symbol as ISymbol; string classValue = string.Format("{0}, {1}, {2}", value, false, true); uniqueValueRenderer.AddValue(classValue, string.Empty, markerSymbol); // ReSharper disable UseIndexedProperty string label = value.ToString(CultureInfo.InvariantCulture); uniqueValueRenderer.set_Label(classValue, label); // ReSharper restore UseIndexedProperty } foreach (var value in pipAdded) { var rotationRenderer = uniqueValueRenderer as IRotationRenderer; if (rotationRenderer != null) { rotationRenderer.RotationField = "PIP1Yaw"; rotationRenderer.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic; } Color color = YearToColor.ContainsKey(value) ? YearToColor[value] : Color.Transparent; ISymbol symbol = ArcUtils.GetPipSymbol(SizeLayer, color); string classValue = string.Format("{0}, {1}, {2}", value, true, true); uniqueValueRenderer.AddValue(classValue, string.Empty, symbol); // ReSharper disable UseIndexedProperty string label = string.Format("{0} (Detail images)", value); uniqueValueRenderer.set_Label(classValue, label); // ReSharper restore UseIndexedProperty activeView.ContentsChanged(); } foreach (var value in forbiddenAdded) { Color color = YearToColor.ContainsKey(value) ? YearToColor[value] : Color.Transparent; ISymbol symbol = ArcUtils.GetForbiddenSymbol(SizeLayer, color); string classValue = string.Format("{0}, {1}, {2}", value, false, false); uniqueValueRenderer.AddValue(classValue, string.Empty, symbol); // ReSharper disable UseIndexedProperty string label = string.Format("{0} (No Authorization)", value); uniqueValueRenderer.set_Label(classValue, label); // ReSharper restore UseIndexedProperty if (pipAdded.Contains(value)) { classValue = string.Format("{0}, {1}, {2}", value, true, false); uniqueValueRenderer.AddValue(classValue, string.Empty, symbol); // ReSharper disable UseIndexedProperty label = string.Format("{0} (Detail images, No Authorization)", value); uniqueValueRenderer.set_Label(classValue, label); // ReSharper restore UseIndexedProperty } activeView.ContentsChanged(); } } } foreach (var value in added) { FrmGlobespotter.UpdateColor(this, value); } }
public static void Add(int entityId, string entityType, FrmGlobespotter frmGlobespotter, bool drawPoint) { Measurements.Add(entityId, new Measurement(entityId, entityType, frmGlobespotter, drawPoint)); }