protected void Page_Load(object sender, EventArgs e) { string agent = ConfigurationManager.AppSettings["MapAgentUrl"]; IServerConnection conn = ConnectionProviderRegistry.CreateConnection( "Maestro.Http", "Url", agent, "SessionId", Request.Params["SESSION"]); IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping); string rtMapId = "Session:" + conn.SessionID + "//" + Request.Params["MAPNAME"] + ".Map"; RuntimeMap rtMap = mpSvc.OpenMap(rtMapId); string xml = Request.Params["SELECTION"]; //The map selection contains one or more layer selections //each containing a one or more sets of identity property values //(because a feature may have multiple identity properties) MapSelection selection = new MapSelection(rtMap, HttpUtility.UrlDecode(xml)); if (selection.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < selection.Count; i++) { MapSelection.LayerSelection layerSel = selection[i]; sb.Append("<p>Layer: " + layerSel.Layer.Name + " (" + layerSel.Count + " selected item)"); sb.Append("<table>"); for (int j = 0; j < layerSel.Count; j++) { sb.Append("<tr>"); object[] values = layerSel[j]; for (int k = 0; k < values.Length; k++) { sb.Append("<td>"); sb.Append(values[k].ToString()); sb.Append("</td>"); } sb.AppendFormat("<td><a href='FeatureInfo.aspx?MAPNAME={0}&SESSION={1}&LAYERID={2}&ID={3}'>More Info</a></td>", rtMap.Name, conn.SessionID, layerSel.Layer.ObjectId, HttpUtility.UrlEncode(layerSel.EncodeIDString(values))); sb.Append("</tr>"); } sb.Append("</table>"); lblMessage.Text = "Showing IDs of selected features"; result.InnerHtml = sb.ToString(); } } else { lblMessage.Text = "Nothing selected. Select some features first then run this sample again."; } }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { Audio?.SetOrientation(q); if (Audio != sel.Audio) { wf.SelectAudio(Audio); } wf.SetWidgetRotation(q); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s) { Entity?.SetScale(s); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetScale(s); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { Entity?.SetPivotPositionFromWidget(p); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetPosition(p); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { Entity?.SetPivotOrientationFromWidget(q); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetRotation(q); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { CarGen?.SetOrientation(q); if (CarGen != sel.CarGenerator) { wf.SelectCarGen(CarGen); } wf.SetWidgetRotation(q); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s) { CarGen?.SetScale(s); if (CarGen != sel.CarGenerator) { wf.SelectCarGen(CarGen); } wf.SetWidgetScale(s); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { Audio?.SetPosition(p); if (Audio != sel.Audio) { wf.SelectAudio(Audio); } wf.SetWidgetPosition(p); }
protected void btnSelect_Click(object sender, EventArgs e) { string agent = ConfigurationManager.AppSettings["MapAgentUrl"]; MAPNAME.Value = Request.Params["MAPNAME"]; SESSION.Value = Request.Params["SESSION"]; IServerConnection conn = ConnectionProviderRegistry.CreateConnection( "Maestro.Http", "Url", agent, "SessionId", SESSION.Value); IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping); string rtMapId = "Session:" + conn.SessionID + "//" + MAPNAME.Value + ".Map"; RuntimeMap rtMap = mpSvc.OpenMap(rtMapId); //Get the selected layer RuntimeMapLayer rtLayer = rtMap.Layers.GetByObjectId(ddlLayers.SelectedValue); //Query using the user filter IFeatureReader reader = conn.FeatureService.QueryFeatureSource( rtLayer.FeatureSourceID, rtLayer.QualifiedClassName, txtFilter.Text); //Get the selection set MapSelection sel = new MapSelection(rtMap); MapSelection.LayerSelection layerSel = null; if (!sel.Contains(rtLayer)) { sel.Add(rtLayer); } layerSel = sel[rtLayer]; //Clear any existing selections layerSel.Clear(); //Populate selection set with query result int added = layerSel.AddFeatures(reader, -1); //Generate selection string string selXml = sel.ToXml(); //Generate a client-side set selection and execute a "Zoom to Selection" afterwards Page.ClientScript.RegisterStartupScript( this.GetType(), "load", "<script type=\"text/javascript\"> window.onload = function() { parent.parent.GetMapFrame().SetSelectionXML('" + selXml + "'); parent.parent.ExecuteMapAction(10); } </script>"); lblMessage.Text = added + " features in " + rtLayer.Name + " selected"; }
void Start() { active = Color.green; inactive = Color.white; quizOptions.gameObject.SetActive(false); counter.gameObject.SetActive(false); value.gameObject.SetActive(false); questionText.gameObject.SetActive(false); questionValue.gameObject.SetActive(false); points.gameObject.SetActive(false); pointsValue.gameObject.SetActive(false); pointer.gameObject.SetActive(false); mapSelection = GetComponent <MapSelection>(); meshRenderer = display.GetComponent <MeshRenderer>(); bOrto = mapSelection.bOrto; bHipso = mapSelection.bHipso; bRegio = mapSelection.bRegio; cityLayerSelection = GetComponent <LayerSelection>(); bCity = cityLayerSelection.bCity; cityName = cityLayerSelection.cityName; waterLayerSelection = GetComponent <LayerSelection>(); bWater = waterLayerSelection.bWater; waterName = waterLayerSelection.waterName; regioLayerSelection = GetComponent <LayerSelection>(); bbRegio = regioLayerSelection.bRegio; regioName = regioLayerSelection.regioName; sevLayerSelection = GetComponent <LayerSelection>(); bSev = sevLayerSelection.bSev; sevName = sevLayerSelection.sevName; int i = 0; objects = new Transform[137]; for (i = 0; i < citiesDisplay.transform.childCount; i++) { objects[i] = citiesDisplay.gameObject.transform.GetChild(i); } for (i = citiesDisplay.transform.childCount; i < citiesDisplay.transform.childCount + waterDisplay.transform.childCount; i++) { objects[i] = waterDisplay.gameObject.transform.GetChild(i - citiesDisplay.transform.childCount); } for (i = citiesDisplay.transform.childCount + waterDisplay.transform.childCount; i < citiesDisplay.transform.childCount + waterDisplay.transform.childCount + regioDisplay.transform.childCount; i++) { objects[i] = regioDisplay.gameObject.transform.GetChild(i - citiesDisplay.transform.childCount - waterDisplay.transform.childCount); } for (i = citiesDisplay.transform.childCount + waterDisplay.transform.childCount + regioDisplay.transform.childCount; i < citiesDisplay.transform.childCount + waterDisplay.transform.childCount + regioDisplay.transform.childCount + sevDisplay.transform.childCount; i++) { objects[i] = sevDisplay.gameObject.transform.GetChild(i - citiesDisplay.transform.childCount - waterDisplay.transform.childCount - regioDisplay.transform.childCount); } }
/// <summary> /// Selects a random mapset within the map manager. /// </summary> private void SelectRandomMapset() { // Try get a random mapset. var mapset = MapManager.AllMapsets.GetRandom(); if (mapset != null) { // Select the mapset. MapSelection.SelectMapset(mapset); } }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { ScenarioNode?.SetPosition(p); if (ScenarioNode != sel.ScenarioNode) { wf.SelectScenarioNode(ScenarioNode); } wf.SetWidgetPosition(p); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { Portal?.SetOrientation(q); if (Portal != sel.NavPortal) { wf.SelectObject(Portal); } wf.SetWidgetRotation(q); //UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { ScenarioNode?.SetOrientation(q); if (ScenarioNode != sel.ScenarioNode) { wf.SelectScenarioNode(ScenarioNode); } wf.SetWidgetRotation(q); //UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s) { LodLight?.SetScale(s); if (LodLight != sel.LodLight) { wf.SelectObject(LodLight); } wf.SetWidgetScale(s); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { LodLight?.SetOrientation(q); if (LodLight != sel.LodLight) { wf.SelectObject(LodLight); } wf.SetWidgetRotation(q); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { Point?.SetPosition(p); if (Point != sel.NavPoint) { wf.SelectNavPoint(Point); } wf.SetWidgetPosition(p); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { Node?.SetPosition(p); if (Node != sel.TrainTrackNode) { wf.SelectTrainTrackNode(Node); } wf.SetWidgetPosition(p); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p) { Portal?.SetPosition(p); if (Portal != sel.NavPortal) { wf.SelectObject(Portal); } wf.SetWidgetPosition(p); UpdateGraphics(wf); }
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 s) { Entity?.SetScale(s); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetScale(s); if ((Entity != null) && (pf != null)) { pf.OnWorldEntityModified(Entity); } }
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q) { CarGen?.SetOrientation(q); if (CarGen != sel.CarGenerator) { wf.SelectCarGen(CarGen); } wf.SetWidgetRotation(q); if ((CarGen != null) && (pf != null)) { pf.OnWorldCarGenModified(CarGen); } }
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 s) { CarGen?.SetScale(s); if (CarGen != sel.CarGenerator) { wf.SelectCarGen(CarGen); } wf.SetWidgetScale(s); if ((CarGen != null) && (pf != null)) { pf.OnWorldCarGenModified(CarGen); } }
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p) { Entity?.SetPositionFromWidget(p); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetPosition(Entity.WidgetPosition); if ((Entity != null) && (pf != null)) { pf.OnWorldEntityModified(Entity); } }
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q) { Entity?.SetOrientationFromWidget(q); if (Entity != sel.EntityDef) { wf.SelectEntity(Entity); } wf.SetWidgetRotation(q); if ((Entity != null) && (pf != null)) { pf.OnWorldEntityModified(Entity); } }
/// <summary> /// Selects the previous map in the map list. /// </summary> public void SelectPrevMap() { var maps = mapList.Value; int index = GetSelectedMapIndex() - 1; if (index < 0) { MapSelection.SelectMap(maps[maps.Count - 1]); } else { MapSelection.SelectMap(maps[index]); } }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p, Vector3 o) { //update selection items positions for new widget position p Selection.MultipleSelectionCenter = o; Selection.SetPosition(p, false); sel.MultipleSelectionCenter = p; //center used for widget pos... wf.SelectMulti(Selection.MultipleSelectionItems); wf.SetWidgetPosition(p); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion r, Quaternion o) { //update selection items positions+rotations for new widget rotation r Selection.MultipleSelectionRotation = o; Selection.SetRotation(r, false); sel.MultipleSelectionRotation = r; //used for widget rot... wf.SelectMulti(Selection.MultipleSelectionItems); wf.SetWidgetRotation(r); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s, Vector3 o) { //update selection items positions for new widget position p Selection.MultipleSelectionScale = o; Selection.SetScale(s, false); sel.MultipleSelectionScale = s; // used for widget scale... wf.SelectMulti(Selection.MultipleSelectionItems); wf.SetWidgetScale(s); UpdateGraphics(wf); }
/// <summary> /// Selects the next map in the map list. /// </summary> public void SelectNextMap() { var maps = mapList.Value; int index = GetSelectedMapIndex() + 1; if (index >= maps.Count) { MapSelection.SelectMap(maps[0]); } else { MapSelection.SelectMap(maps[index]); } }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s) { if (Polygon != null) { Polygon.Scale = s; } if (Polygon != sel.CollisionPoly) { wf.SelectObject(Polygon); } wf.SetWidgetScale(s); UpdateGraphics(wf); }
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s) { if (Bounds != null) { Bounds.Scale = s; } if (Bounds != sel.CollisionBounds) { wf.SelectObject(Bounds); } wf.SetWidgetScale(s); UpdateGraphics(wf); }
void OnSelectionChanged(MapSelection selection) { if (!selection.IsSelectionValid) { this.SelectionTileAreaView.ClearTarget(); } else { this.SelectionTileAreaView.SetTarget(this.Environment, selection.SelectionBox); } }
void OnGotSelection(MapSelection selection) { if (this.GotSelection != null) this.GotSelection(selection); }
/// <summary> /// Convenience method for rendering a dynamic overlay of the current map /// </summary> /// <param name="selection"></param> /// <param name="format"></param> /// <param name="selectionColor"></param> /// <param name="behaviour">A bitmask for the rendering behaviour (1 = Render Selection, 2 = Render Layers, 4 = Keep Selection, 8 = Render Base Layers)</param> /// <returns></returns> public System.IO.Stream RenderDynamicOverlay(MapSelection selection, string format, Color selectionColor, int behaviour) { if (_mapSvc == null) throw new NotSupportedException(); return _mapSvc.RenderDynamicOverlay( this, selection, format, selectionColor, behaviour); }
public override Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behaviour) { MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService; MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService; MgMap mmap = new MgMap(); mmap.Open(res, map.Name); MgSelection sel = new MgSelection(mmap); if (selection != null) sel.FromXml(selection.ToXml()); var rndOpts = new MgRenderingOptions(format, behaviour, new MgColor(selectionColor)); GetByteReaderMethod fetch = () => { return rnd.RenderDynamicOverlay(mmap, sel, rndOpts); }; LogMethodCall("MgRenderingService::RenderDynamicOverlay", true, "MgMap", "MgSelection", "MgRenderingOptions"); return new MgReadOnlyStream(fetch); }
/// <summary> /// Renders a dynamic overlay image of the map /// </summary> /// <param name="map"></param> /// <param name="selection"></param> /// <param name="format"></param> /// <param name="selectionColor"></param> /// <param name="behaviour"></param> /// <returns></returns> public abstract System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behaviour);
/// <summary> /// Renders a dynamic overlay image of the map /// </summary> /// <param name="map"></param> /// <param name="selection"></param> /// <param name="format"></param> /// <param name="keepSelection"></param> /// <returns></returns> public abstract System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection);
/// <summary> /// Renders a dynamic overlay image of the map /// </summary> /// <param name="map"></param> /// <param name="selection"></param> /// <param name="format"></param> /// <returns></returns> public System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format) { return RenderDynamicOverlay(map, selection, format, true); }
public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.Net.WebRequest req = m_reqBuilder.GetDynamicMapOverlayImage(map.Name, (selection == null ? string.Empty : selection.ToXml()), format, ms); //Maksim reported that the rendering times out frequently, so now we wait 5 minutes req.Timeout = 5 * 60 * 1000; using (System.IO.Stream rs = req.GetRequestStream()) { Utility.CopyStream(ms, rs); rs.Flush(); var resp = req.GetResponse(); var hwr = resp as HttpWebResponse; if (hwr != null) LogResponse(hwr); return resp.GetResponseStream(); } }
private void InitViewerFromMap(double? initialScale) { this.BackColor = _map.BackgroundColor; _map.DisplayWidth = this.Width; _map.DisplayHeight = this.Height; _selection = _map.Selection; _overlayRenderOpts = CreateMapRenderingOptions(0, 0, 255); _selectionRenderOpts = CreateSelectionRenderingOptions(0, 0, 255); var env = _map.MapExtent; _extX1 = _orgX1 = env.MinX; _extY2 = _orgY2 = env.MinY; _extX2 = _orgX2 = env.MaxX; _extY1 = _orgY1 = env.MaxY; if ((_orgX1 - _orgX2) == 0 || (_orgY1 - _orgY2) == 0) { _extX1 = _orgX1 = -.1; _extY2 = _orgX2 = .1; _extX2 = _orgY1 = -.1; _extY1 = _orgY2 = .1; } if (this.ConvertTiledGroupsToNonTiled) { var groups = _map.Groups; for (int i = 0; i < groups.Count; i++) { var group = groups[i]; group.Type = RuntimeMapGroup.kNormal; var layers = _map.GetLayersOfGroup(group.Name); for (int j = 0; j < layers.Length; j++) { layers[j].Type = RuntimeMapLayer.kDynamic; } } } #if VIEWER_DEBUG CreateDebugFeatureSource(); #endif this.Focus(); //Reset history stack _viewHistory.Clear(); OnPropertyChanged("ViewHistory"); _viewHistoryIndex = -1; OnPropertyChanged("ViewHistoryIndex"); var handler = this.MapLoaded; if (handler != null) handler(this, EventArgs.Empty); if (initialScale.HasValue) ZoomToScale(initialScale.Value); else InitialMapView(); }
public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behavior) { //This API was introduced in MGOS 2.1 so this won't work with older versions if (this.SiteVersion < new Version(2, 1, 0)) throw new NotSupportedException(); System.IO.MemoryStream ms = new System.IO.MemoryStream(); var req = m_reqBuilder.GetDynamicMapOverlayImage(map.Name, (selection == null ? string.Empty : selection.ToXml()), format, selectionColor, behavior); return this.OpenRead(req); }
public override Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection) { MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService; MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService; GetByteReaderMethod fetch = () => { MgMap mmap = new MgMap(); mmap.Open(res, map.Name); MgSelection sel = new MgSelection(mmap); if (selection != null) sel.FromXml(selection.ToXml()); return rnd.RenderDynamicOverlay(mmap, sel, format, keepSelection); }; LogMethodCall("MgRenderingService::RenderDynamicOverlay", true, "MgMap", "MgSelection", format, keepSelection.ToString()); return new MgReadOnlyStream(fetch); }
public System.IO.Stream RenderDynamicOverlay(MapSelection sel, string format, bool keepSelection) { if (_mapSvc == null) throw new NotSupportedException(); return _mapSvc.RenderDynamicOverlay( this, sel, format, keepSelection); }
private static int GetSelectionTotal(MapSelection sel) { int total = 0; for (int i = 0; i < sel.Count; i++) { total += sel[i].Count; } return total; }