/// <summary> /// Creates a new instance of MouseArgs /// </summary> /// <param name="e"></param> /// <param name="inMap"></param> public GeoMouseArgs(MouseEventArgs e, IMap inMap) : base(e.Button, e.Clicks, e.X, e.Y, e.Delta) { if (inMap == null) return; GeographicLocation = inMap.PixelToProj(e.Location); Map = inMap; }
public Tile(IMap map,Rectangle tile,Rectangle rect, bool collides) : base(map,rect, -1) { _collides = collides; _selectRect = tile; _map = map; }
public bool checkPathExists(IMap env, int start, int target) { m_env = env; m_target = target; closedList = new bool[env.NrNodes]; return searchPathExists(start, 0); }
public override void OnClick() { try { var mxdoc = (IMxDocument)_application.Document; _map = mxdoc.FocusMap; var addWmsCForm = new AddWmsCForm(); var result = addWmsCForm.ShowDialog(new ArcMapWindow(_application)); if (result == DialogResult.OK) { var tileSource = addWmsCForm.SelectedTileSource; IConfig configWmsC = new ConfigWmsC(tileSource); var brutileLayer = new BruTileLayer(_application,configWmsC) { Name = configWmsC.CreateTileSource().Schema.Name, Visible = true }; _map.AddLayer(brutileLayer); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void BuildCorridor(IMap map, MapCell currentCell) { MapCell nextCell; var direction = Dir.Zero; bool success; do { _directionPicker.LastDirection = direction; _directionPicker.ResetDirections(); var emptySide = currentCell.Sides .Single(s => s.Value != Side.Wall) .Key; success = false; do { direction = _directionPicker.NextDirectionExcept(emptySide); success = map.TryGetAdjacentCell(currentCell, direction, out nextCell); if (success) { map.CreateCorridorSide(currentCell, nextCell, direction, Side.Empty); } } while (_directionPicker.HasDirections && !success); if (!success) { return; } } while (currentCell.IsDeadEnd); }
public virtual bool Update(IMap map, float seconds) { if (_info.Physics) { this.Movement.Y += Player.gravity * seconds; Move(new Vector2(0,Movement.Y*seconds)); if (map.Collides(this)) { Move(new Vector2(0, -Movement.Y*seconds)); Movement.Y *= -_info.bounceFactor; Movement.X *= _info.bounceFactor; if (_info.CollisionDespawn) return false; } Move(new Vector2(Movement.X*seconds, 0)); if (map.Collides(this)) { Move(new Vector2(-Movement.X*seconds,0)); Movement.X *= -_info.bounceFactor; Movement.Y *= _info.bounceFactor; if (_info.CollisionDespawn) return false; } } else { Move(Movement * seconds); if (_info.CollisionDespawn && map.Collides(this)) return false; } lifeTime -= seconds; _angle = (float)Math.Atan2(Movement.Y, Movement.X); return lifeTime>0; }
/// <summary> /// ��һ��Map��ӵ������� /// </summary> /// <param name="Map"></param> public void Add(IMap Map) { if (Map == null) throw new Exception("Maps::Add:\r\n�µ�ͼû�г�ʼ��!"); _mapList.Add(Map); }
public frmSummarizeByField(IMap map) { InitializeComponent(); rsUtil = new rasterUtil(); mp = map; populateComboBox(); }
private IMap pMap = null; // ����pMap #endregion Fields #region Constructors public frmAttribute(IMap ppMap,int iLayerID) { InitializeComponent(); pMap = ppMap; pLayerID = iLayerID; pfrmAttribute = this; }
private void FindOneToOnes(IMap map, IAnswerProvider answerProvider) { foreach (var column in map.Columns.Where(c => c.Value.Relationship == RelationshipType.ManyToOne)) { var otherMapCandidates = column.Value.ParentMap.Columns.Where( c => c.Value.Type == column.Value.Map.Type && (column.Value.ParentMap != map || c.Key != column.Key)).ToArray(); if (otherMapCandidates.Length == 0) { continue; } else if (otherMapCandidates.Length == 1) { column.Value.Relationship = RelationshipType.OneToOne; // one relationship coming back, assume one to one column.Value.OppositeColumn = otherMapCandidates.First().Value; } else { // we've got more than 1 foreign key coming back - let's ask the user var choices = otherMapCandidates.Select(c => new MultipleChoice<IColumn> { DisplayString = c.Key, Choice = c.Value }).ToList(); const string oneToOneText = "No matching column but one-to-one"; const string manyToOneText = "No matching column but many-to-one"; choices.Add(new MultipleChoice<IColumn> { DisplayString = oneToOneText, Choice = new Column<string> { Name = "One to One" } }); choices.Add(new MultipleChoice<IColumn> { DisplayString = manyToOneText, Choice = new Column<string> { Name = "Many to One" } }); var oppositeColumn = answerProvider.GetMultipleChoiceAnswer( "The column " + column.Key + " on " + column.Value.Map.Table + " has multiple incoming relationships. Which column on the related table is the other side of the one-to-one relationship?", choices); if (oppositeColumn.DisplayString == manyToOneText) { continue; // many to one } column.Value.Relationship = RelationshipType.OneToOne; if (oppositeColumn.DisplayString != oneToOneText) { column.Value.OppositeColumn = oppositeColumn.Choice; } } } }
public PlanetGenerator(IMap map, IRandom random) { _map = map; _random = random; MaximumMapSize = new Size(10000,10000); MaximumPlanetSize = 250; }
public static IMosaicLayer FindMyMosaicLayer(IMap inMap, string inName) { string isfound = "false"; ILayer tempLayer; IMosaicLayer goodMLayer = new MosaicLayerClass(); for (int i = 0; i < inMap.LayerCount; i++) { tempLayer = inMap.get_Layer(i); if (tempLayer is IMosaicLayer) { if (tempLayer.Name == inName) { isfound = "true"; goodMLayer = tempLayer as IMosaicLayer; } } } if (isfound == "true") { return goodMLayer; } else { return null; } }
public AdventureStage(IMap map , IStorage storage , User user) { _User = user; _Observeds = new List<IObservedAbility>(); _Stroage = storage; _Map = map; }
protected override void ExecuteCommand(IMap map, DungeonParameters parameters) { var sparseFactor = parameters.CellSparseFactor; var expectedNumberOfRemovedCells = (int)Math.Ceiling(map.Size * (sparseFactor / 100m)) - 1; var removedCellsCount = 0; var nonWalls = map.Where(c => !c.IsWall).ToList(); if (!nonWalls.Any()) { throw new InvalidOperationException("All cells are walls."); } while (removedCellsCount < expectedNumberOfRemovedCells) { foreach (var cell in nonWalls.Where(c => c.IsDeadEnd).ToList()) { if (!cell.IsDeadEnd) continue; var emptySide = cell.Sides .Single(s => s.Value != Side.Wall) .Key; map.CreateWall(cell, emptySide); cell.IsCorridor = false; nonWalls.Remove(cell); removedCellsCount++; } } }
public static IFeatureLayer FindMyFeatureLayer(IMap inMap, string inName) { string isfound = "false"; ILayer tempLayer; IFeatureLayer goodLayer = new FeatureLayerClass(); for (int i = 0; i < inMap.LayerCount; i++) { tempLayer = inMap.get_Layer(i); if (tempLayer is IFeatureLayer) { if (tempLayer.Name == inName) { isfound = "true"; goodLayer = tempLayer as IFeatureLayer; } } } //duplicate name in the map.? How we deal with it if (isfound == "true") { return goodLayer; } else { return null; } }
public Regulus.Project.Crystal.Game.Core CreateUser(Regulus.Remoting.ISoulBinder binder, IStorage storage, IMap zone , Battle.IZone battle) { var core = new Regulus.Project.Crystal.Game.Core(binder, storage, zone, battle); _Users.AddFramework(core); core.InactiveEvent += () => { _Users.RemoveFramework(core); }; return core; }
public StepOnButton(string triggerName, bool global, IMap map, Rectangle rect, int id) : base(map, rect, id) { _triggerName = triggerName; _global = global; _objectType = 84; }
// TODO : it is not common normalize protected void NormalizeCornerElevation(IMap map) { // TODO: check why max and min elivations are so low var maxElevation = map.GetMaxCornerElevation; if (maxElevation > 0) { foreach (var corner in map.Corners.Where(c => c.Elevation >= 0)) { corner.Elevation /= maxElevation; corner.Elevation *= corner.Elevation; } } var minElevation = -map.Corners.Min(c => c.Elevation); if (minElevation > 0) { foreach (var corner in map.Corners.Where(c => c.Elevation < 0)) { corner.Elevation /= minElevation; corner.Elevation *= -corner.Elevation; } } // TODO: Remove if (map.Corners.Any(c => Math.Abs(c.Elevation) > 1)) { throw new ApplicationException("TTT"); } }
private void BuildGrid() { grid = LineGrid<SpriteCell> .BeginShape() .Segment(300) .EndShape(); map2D = new ArchimedeanSpiralMap(CellDimensions, grid) .AnchorCellMiddleCenter() .WithWindow(ExampleUtils.ScreenRect) .AlignMiddleCenter(grid); map = map2D .To3DXY(); foreach (var point in grid) { var cell = Instantiate(cellPrefab); Vector3 worldPoint = map[point]; cell.transform.parent = root.transform; cell.transform.localScale = Vector3.one; cell.transform.localPosition = worldPoint; cell.Color = ExampleUtils.Colors[ColorFunction(point)] + Color.white * 0.2f; cell.name = point.ToString(); grid[point] = cell; } voronoiMap = new VoronoiMap<LinePoint>(grid, map2D); ExampleUtils.PaintScreenTexture(plane, voronoiMap, ColorFunction); }
public int CompareTo(IMap other) { int compare; IEnumerator<KeyValuePair<Value, Value>> lhs; IEnumerator<KeyValuePair<Value, Value>> rhs; if (other == null) return 1; if (this.Count < other.Count) return -1; else if (this.Count > other.Count) return 1; lhs = this.GetEnumerator (); rhs = other.GetEnumerator (); while (lhs.MoveNext () && rhs.MoveNext ()) { compare = lhs.Current.Key.CompareTo (rhs.Current.Key); if (compare != 0) return compare; compare = lhs.Current.Value.CompareTo (rhs.Current.Value); if (compare != 0) return compare; } return 0; }
public frmWeightedAverageByAreaOrLength(IMap map) { InitializeComponent(); rsUtil = new rasterUtil(); mp = map; populateComboBox(); }
public override string ChangeTableName(IMap @from, IMap to) { var sql = new StringBuilder("alter table "); this.AppendQuotedTableName(sql, from); sql.Append(" rename to "); this.AppendQuotedTableName(sql, to); return sql.ToString(); }
internal PathToPlayer( Player player, IMap map, Texture2D sprite ) { _player = player; _map = map; _sprite = sprite; _pathFinder = new PathFinder( map ); }
private static int CalculateRoomScore(Room room, IMap map, MapCell cell) { var currentScore = 0; foreach (var roomCell in room) { var currentCell = map[ roomCell.Location.X + cell.Location.X, roomCell.Location.Y + cell.Location.Y]; currentScore += AdjacentCorridorBonus * roomCell.Sides .Count(s => HasAdjacentCorridor(map, currentCell, s.Key)); if (currentCell.IsCorridor) { currentScore += OverlappedCorridorBonus; } currentScore += OverlappedRoomBonus * map.Rooms.Count(r => r.Bounds.Contains(currentCell.Location)); } return currentScore; }
/// <summary> /// 将一个Map添加到集合中 /// </summary> /// <param name="Map"></param> public void Add(IMap Map) { if (Map == null) throw new Exception("Maps::Add:\r\n新地图没有初始化!"); _mapList.Add(Map); }
public static EffectItem Create( IPoint3D p, IMap map, TimeSpan duration ) { EffectItem item = null; for ( int i = m_Free.Count - 1; item == null && i >= 0; --i ) // We reuse new entries first so decay works better { EffectItem free = (EffectItem) m_Free[i]; m_Free.RemoveAt( i ); if ( !free.Deleted && free.Map == Map.Internal ) item = free; } if ( item == null ) { item = new EffectItem(); } else { item.ItemID = 1; } item.MoveToWorld( new Point3D( p ), map as Map ); item.BeginFree( duration ); return item; }
public frmSummarizeGraphSedimentByArivalTime() { InitializeComponent(); mp = null; rsUtil = new rasterUtil(); populateComboBox(); }
/// <summary> /// Constructs a new PathFinder instance for the specified Map /// </summary> /// <param name="map">The Map that this PathFinder instance will run shortest path algorithms on</param> /// <exception cref="ArgumentNullException">Thrown on null map</exception> public PathFinder( IMap map ) { if ( map == null ) { throw new ArgumentNullException( "map", "Map cannot be null" ); } _map = map; _graph = new EdgeWeightedDigraph( _map.Width * _map.Height ); foreach ( Cell cell in _map.GetAllCells() ) { if ( cell.IsWalkable ) { int v = IndexFor( cell ); foreach ( Cell neighbor in _map.GetBorderCellsInRadius( cell.X, cell.Y, 1 ) ) { if ( neighbor.IsWalkable ) { int w = IndexFor( neighbor ); _graph.AddEdge( new DirectedEdge( v, w, 1.0 ) ); _graph.AddEdge( new DirectedEdge( w, v, 1.0 ) ); } } } } }
public bool HandleInput(InputState inputState, IMap map) { var potential_new_x = X; var potential_new_y = Y; bool trying_to_move = false; if (inputState.IsLeft(PlayerIndex.One)) { potential_new_x = X - speed; trying_to_move = true; } else if (inputState.IsRight(PlayerIndex.One)) { potential_new_x = X + speed; trying_to_move = true; } else if (inputState.IsUp(PlayerIndex.One)) { potential_new_y = Y - speed; trying_to_move = true; } else if (inputState.IsDown(PlayerIndex.One)) { potential_new_y = Y + speed; trying_to_move = true; } if (trying_to_move) { if (map.IsWalkable(potential_new_x, potential_new_y)) { var enemy = Global.CombatManager.EnemyAt(potential_new_x, potential_new_y); if (enemy == null) { X = potential_new_x; Y = potential_new_y; } else { Global.CombatManager.Attack(this, enemy); } return true; } } return false; }
public override bool Update(IMap map, float seconds) { bool alive = base.Update(map, seconds); Modules.ModuleManager.DoEffect(4, map, -this.Movement, this.Rect.Center, ""); map.SetGlow(_id, this.MidPosition, Microsoft.Xna.Framework.Color.Green, 20, false, 300); return alive; }
private static void DeserializeLegend(dynamic layer, IMap map, Layer imageLayer) { //// var polyLayer = imageLayer as MapImageLayer; ////// var imageSymbolizer = new ImageSymbolizer(); ////// var outlineColor = LegacyDeserializer.GetColor(layer.ShapeFileProperties["OutLineColor"]); ////// var outlineWidth = Convert.ToDouble(layer.ShapeFileProperties["LineOrPointSize"]); ////// polySymbolizer.SetOutline(outlineColor, outlineWidth); ////// if (Convert.ToBoolean(layer.ShapeFileProperties["DrawFill"])) //////{ ////// System.Drawing.Color color = LegacyDeserializer.GetColor(layer.ShapeFileProperties["Color"]); ////// float transparency = Convert.ToSingle(layer.ShapeFileProperties["TransparencyPercent"]); ////// color = color.ToTransparent(transparency); ////// polySymbolizer.SetFillColor(color); //////} ////// else //////{ ////// polySymbolizer.SetFillColor(Color.Transparent); //////} ////// layer.Symbolizer = imageSymbolizer; //// var j = layer.Break; //// try ////{ //// int fieldIndex = Convert.ToInt32(layer.ShapeFileProperties.Legend["FieldIndex"]); //// // we have to clear the categories or the collection ends up with a default item //// polyLayer.Symbology.Categories.Clear(); //// // foreach (var colorBreak in layer.ShapeFileProperties.Legend.ColorBreaks.Elements()) //// //{ //// // PolygonCategory category; //// // string startValue = colorBreak["StartValue"]; //// // string endValue = colorBreak["EndValue"]; //// // if (startValue == endValue) //// // { //// // category = new PolygonCategory(LegacyDeserializer.GetColor(colorBreak["StartColor"]), LegacyDeserializer.GetColor(colorBreak["StartColor"]), 0); //// // category.FilterExpression = String.Format("[{0}] = '{1}'", polyLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName, startValue); //// // category.LegendText = startValue; //// // } //// // else //// // { //// // category = new PolygonCategory(LegacyDeserializer.GetColor(colorBreak["StartColor"]), LegacyDeserializer.GetColor(colorBreak["EndColor"]), 0, GradientType.Linear, outlineColor, outlineWidth); //// // category.FilterExpression = String.Format("'{2}' >= [{0}] >= '{1}'", polyLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName, startValue, endValue); //// // category.LegendText = String.Format("{0} - {1}", startValue, endValue); ; //// // } //// // category.LegendText = startValue; //// // category.LegendItemVisible = Convert.ToBoolean(colorBreak["Visible"]); //// // polyLayer.Symbology.AddCategory(category); //// //} //// // it took too a lot of work to figure out that we would need to do this... //// polyLayer.ApplyScheme(polyLayer.Symbology); ////} //// catch (RuntimeBinderException) ////{ //// // ignore and continue. //// // this means the legend is not available. ////} }
public ReadOnlyMap(IMap <KEY, VALUE> backingMap) { this.backingMap = backingMap; }
public House(ITime time, IMap map, PositiveInt income, PositiveInt heal) : base(time, map, income, heal) { }
/// <summary> /// 设置属性表中的字段值 /// </summary> /// <param name="map">IMap对象</param> /// <param name="layerName">图层名称</param> /// <param name="fieldName">字段名</param> /// <param name="value">字段值</param> /// <param name="checkArea">是否检查小面积</param> /// <param name="area">小面积阈值,如果<b>checkArea</b>设置为false,则此值无效</param> public static void setValue(IMap map, string layerName, string fieldName1, object value1, string fieldName2, object value2, double area = -1) { IFeatureCursor pCursor = Utils.getSelectFeatures(map, layerName); IFeature pFeature = pCursor.NextFeature(); if (pFeature == null) { return; } int pIndex1 = -1, pIndex2 = -1; try { //找字段 pIndex1 = pFeature.Fields.FindFieldByAliasName(fieldName1); pIndex2 = pFeature.Fields.FindFieldByAliasName(fieldName2); //MessageBox.Show(pIndex1 + "---" + pIndex2); } catch (Exception) { StringBuilder sb = new StringBuilder(); sb.Append("字段["); if (pIndex1 == -1) { sb.Append(fieldName1); sb.Append("]"); if (pIndex2 == -1) { sb.Append("及["); sb.Append(fieldName2); sb.Append("]"); } } else if (pIndex2 == -1) { sb.Append(fieldName2); sb.Append("]"); } sb.Append("未找到"); MessageBox.Show(sb.ToString()); } if (pIndex1 >= 0 && pIndex2 >= 0) { while (pFeature != null) { IArea pArea = pFeature.Shape as IArea; if (area == -1 || pArea.Area >= area) { //设置属性表中的值 pFeature.Value[pIndex1] = value1; pFeature.Value[pIndex2] = value2; pFeature.Store(); } else { ShowDialogWarning("当前图斑面积为:" + pArea.Area + "m²,小于临界面积:" + area + "m²。"); } pFeature = pCursor.NextFeature(); } } else { StringBuilder sb = new StringBuilder(); sb.Append("字段["); if (pIndex1 == -1) { sb.Append(fieldName1); sb.Append("]"); if (pIndex2 == -1) { sb.Append("及["); sb.Append(fieldName2); sb.Append("]"); } } else if (pIndex2 == -1) { sb.Append(fieldName2); sb.Append("]"); } sb.Append("未找到"); MessageBox.Show(sb.ToString()); } }
internal static Mock <IMapper <BookCatalogFilter> > WithMap(this Mock <IMapper <BookCatalogFilter> > mock, IMap filterMap) { mock.Setup(m => m.Map(It.IsAny <BookCatalogFilter>())).Returns(filterMap); return(mock); }
public shuxingbiao(IMap pmap) { InitializeComponent(); this.smap = pmap; Opentable(); }
/// <summary> /// Called when [click]. /// </summary> protected override void OnClick() { Trace.WriteLine("OpenGoogleStreetView_OnClick"); ArcMap.Application.CurrentTool = null; IMap map = ArcMap.Document.FocusMap; try { IMxDocument doc = ArcMap.Document; if (doc.FocusMap.SpatialReference != null || doc.FocusMap.SpatialReference is IUnknownCoordinateSystem) { ISpatialReference spatialrefWGS84 = this.WGS84SpatialReference(); ISpatialReference spatialrefMap = doc.FocusMap.SpatialReference; IEnvelope env = doc.ActiveView.Extent; IPoint pt; double metersPerUnit = 1; if (spatialrefMap is IProjectedCoordinateSystem) { IProjectedCoordinateSystem pcs = (IProjectedCoordinateSystem)spatialrefMap; metersPerUnit = pcs.CoordinateUnit.MetersPerUnit; } spatialrefWGS84.SetFalseOriginAndUnits(-180, -90, 1000000); env.Project(spatialrefWGS84); IArea extentArea = (IArea)env; pt = extentArea.Centroid; QueryStringBuilder querystring = new QueryStringBuilder(); querystring.MapCenterLatitude = pt.Y; querystring.MapCenterLongitude = pt.X; QueryStringBuilder.StreetViewParameter streetviewParameter = new QueryStringBuilder.StreetViewParameter(pt.Y, pt.X); querystring.StreetView = streetviewParameter; string url = querystring.ToString(); Trace.WriteLine("url=" + url); Process.Start(url); } else { System.Windows.Forms.MessageBox.Show( "A data frame spatial reference must be specified in order to use this tool.", "Umbriel Google Street View", System.Windows.Forms.MessageBoxButtons.OK); } } catch (Exception ex) { Trace.WriteLine(ex.StackTrace); System.Windows.Forms.MessageBox.Show( "GoogleStreetView Command Error: " + ex.Message + "\n\n" + ex.StackTrace, "Umbriel.GoogleStreetView", System.Windows.Forms.MessageBoxButtons.OK); } }
public FloorState(DungeonState dungeon, IEnumerable <Entity> mapEntities, string mapID, IMap arenaMap, PathFinder arenaPathFinder, int level) { this.dungeon = dungeon; this.mapEntities = new List <Entity>(); foreach (Entity e in mapEntities) { this.mapEntities.Add(e); } this.MapID = mapID; this.FloorMap = arenaMap; this.FloorPathFinder = arenaPathFinder; this.Level = level; }
private void QueryForestByAttri(DevComponents.AdvTree.Node pXZQnode, IMap pMap) { if (pXZQnode == null) { return; } //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); try { string strTag = pXZQnode.Tag.ToString(); string strCode = pXZQnode.Name; if (strTag.ToUpper() == "TOWN") { DevComponents.AdvTree.Node pParentNode = pXZQnode.Parent; string strTmpCode = pParentNode.Name; strCode = strTmpCode + strCode.Substring(1, 2); } string strNodeKey = SysCommon.ModSysSetting.GetLinBanLayerNodeKey(Plugin.ModuleCommon.TmpWorkSpace); ILayer pLayer = SysCommon.ModuleMap.GetLayerByNodeKey(null, pMap, strNodeKey, null, true); SysCommon.BottomQueryBar pQueryBar = _hook.QueryBar; if (pQueryBar.m_WorkSpace == null) { pQueryBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (pQueryBar.ListDataNodeKeys == null) { pQueryBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID; } esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); //ygc 20130326 根据山西数据格式修改条件合成方式 if (strTag.ToUpper() == "TOWN") { pQueryFilter.WhereClause = "xiang ='" + strCode + "00'"; } else if (strTag.ToUpper() == "County") { pQueryFilter.WhereClause = "XIANG = '" + strCode + "'"; } else if (strTag.ToUpper() == "City") { pQueryFilter.WhereClause = "shi = '" + strCode + "00'"; } else { pQueryFilter.WhereClause = "XIANG like '" + strCode + "%'"; } pQueryBar.m_pMapControl = _hook.MapControl; vProgress.SetProgress("获取查询结果..."); pQueryBar.EmergeQueryData(pLayer as IFeatureLayer, pQueryFilter, vProgress); vProgress.Close(); try { DevComponents.DotNetBar.Bar pBar = pQueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; //pBar.SelectedDockTab = 1; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } } catch { vProgress.Close(); } vProgress = null; }
private static void DeserializeLabels(dynamic labels, IMap map, IFeatureLayer featureLayer) { int fieldIndex = Convert.ToInt32(labels["Field"]) - 1; var fieldName = featureLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName; var symbolizer = new LabelSymbolizer(); symbolizer.FontFamily = labels["Font"]; try { if (Convert.ToBoolean(labels["Bold"])) { symbolizer.FontStyle = FontStyle.Bold; } else if (Convert.ToBoolean(labels["Italic"])) { symbolizer.FontStyle = FontStyle.Italic; } else if (Convert.ToBoolean(labels["Underline"])) { symbolizer.FontStyle = FontStyle.Underline; } } catch (RuntimeBinderException) { // ignore and continue. // some versions of the files don't have these properties. } symbolizer.FontColor = LegacyDeserializer.GetColor(labels["Color"]); LegacyHJustification typeOfJustification = (LegacyHJustification)Enum.ToObject(typeof(LegacyHJustification), Convert.ToInt32(labels["Justification"])); switch (typeOfJustification) { case LegacyHJustification.Center: symbolizer.Orientation = ContentAlignment.MiddleCenter; break; case LegacyHJustification.Left: symbolizer.Orientation = ContentAlignment.MiddleLeft; break; case LegacyHJustification.Right: symbolizer.Orientation = ContentAlignment.MiddleRight; break; case LegacyHJustification.None: case LegacyHJustification.Raw: default: break; } try { symbolizer.DropShadowEnabled = Convert.ToBoolean(labels["UseShadows"]); symbolizer.DropShadowColor = LegacyDeserializer.GetColor(labels["Color"]); } catch (RuntimeBinderException) { } // not entirely sure if Offset from MW4 translates to OffsetX. try { symbolizer.OffsetX = Convert.ToInt32(labels["Offset"]); } catch (RuntimeBinderException) { } string expression = $"[{fieldName}]"; featureLayer.AddLabels(expression, null, symbolizer, expression); featureLayer.LabelLayer.UseDynamicVisibility = Convert.ToBoolean(labels["UseMinZoomLevel"]); try { featureLayer.LabelLayer.DynamicVisibilityWidth = Convert.ToDouble(labels["Scale"]); } catch (RuntimeBinderException) { } }
public bool CanRender(gView.Framework.Data.IFeatureLayer layer, IMap map) { return(true); }
public Controller() { guns = new GunRepository(); players = new PlayerRepository(); map = new Map(); }
/// <summary> /// Constructs a new instance of a GoalMap for the specified Map that will not consider diagonal movements to be valid. /// </summary> /// <param name="map">The Map that this GoalMap will be created for</param> /// <exception cref="ArgumentNullException">Thrown on null map</exception> public GoalMap(IMap map) : this(map, false) { }
public int Compare(IMap <string, object> map1, IMap <string, object> map2) { return(42); }
public void Init() { map = Client.GetMap <object, object>(TestSupport.RandomString()); FillMap(); }
public GetContactHandler(IWeeeAuthorization authorization, IGenericDataAccess dataAccess, IMap <Contact, ContactData> mapper) { this.authorization = authorization; this.dataAccess = dataAccess; this.mapper = mapper; }
/// <summary> /// Constructs a new FieldOfView class for the specified Map /// </summary> /// <param name="map">The Map that this FieldOfView class will use to perform its field-of-view calculations</param> public FieldOfView(IMap map) { _map = map; _inFov = new HashSet <int>(); }
public GetOriginalNumberOfShipmentsHandler(INumberOfShipmentsHistotyRepository repository, IMap <NumberOfShipmentsHistory, NumberOfShipmentsHistoryData> map) { this.repository = repository; this.map = map; }
private void AddLayerToMap(IMap map, ILayer layer) { (map as IMapLayers2).InsertLayer(layer, true, 0); }
internal FieldOfView(IMap map, HashSet <int> inFov) { _map = map; _inFov = inFov; }
/// <summary> /// Creates a new instance of AddShapeFunction, but specifies /// the Map that this function should be applied to. /// </summary> /// <param name="map"></param> public MapFunctionMeasure(IMap map) : base(map) { Configure(); }
/// <summary> /// Initializes a new instance of the <see cref="LegacyProjectDeserializer"/> class. /// </summary> /// <param name="map">The map.</param> public LegacyProjectDeserializer(IMap map) { _map = map; }
public MapTopItemsWithPartitionKeyToOverallEntries(IMap <TopItemWithPartitionKey, OverallEntry> mapTopItemToOverallEntry) { this.mapTopItemWithPartitionKeyToOverallEntry = mapTopItemToOverallEntry; }
private void LoadData(string pFileName) { geoFeatureLayer.Clear(); annoLayers.Clear(); IMapDocument pMapDocument = new MapDocument(); pMapDocument.Open(pFileName, ""); IMap map = pMapDocument.ActiveView.FocusMap; for (int i = 0; i < map.LayerCount; i++) { ILayer layer = map.get_Layer(i); ReadMapLayer(layer); } if (geoFeatureLayer.Count > 0) { foreach (IGeoFeatureLayer gfl in geoFeatureLayer) { DataRow dr = _dt.NewRow(); dr["FeatureClassAlias"] = gfl.FeatureClass.AliasName; dr["FeatureClassName"] = gfl.Name; dr["FeatureClass"] = gfl.FeatureClass; dr["CheckState"] = true; FacilityClass facC = DF2DData.Class.Dictionary2DTable.Instance.GetFacilityClassByDFFeatureClassID(gfl.FeatureClass.FeatureClassID.ToString()); if (facC != null) { dr["FacilityClass"] = facC; } else { foreach (FacilityClass facTemp in FacilityClassManager.Instance.GetAllFacilityClass()) { if (gfl.FeatureClass.AliasName.Contains(facTemp.Alias)) { dr["FacilityClass"] = facTemp; break; } } } MajorClass mc = LogicDataStructureManage2D.Instance.GetMajorClassByDFFeatureClassID(gfl.FeatureClass.FeatureClassID.ToString()); if (mc != null) { dr["MajorClass"] = mc; } else { foreach (MajorClass mcTemp in LogicDataStructureManage2D.Instance.GetAllMajorClass()) { if (gfl.FeatureClass.AliasName.Contains(mcTemp.Alias)) { dr["MajorClass"] = mcTemp; break; } } } this._dt.Rows.Add(dr); } } if (annoLayers.Count > 0) { foreach (IAnnotationLayer gfl in annoLayers) { DataRow dr = _dt.NewRow(); IFeatureLayer fl = gfl as IFeatureLayer; if (fl == null) { continue; } IFeatureClass featureClass = fl.FeatureClass; if (featureClass == null) { continue; } dr["FeatureClassAlias"] = featureClass.AliasName; dr["FeatureClassName"] = (gfl as ILayer).Name; dr["FeatureClass"] = featureClass; dr["CheckState"] = true; FacilityClass facC = DF2DData.Class.Dictionary2DTable.Instance.GetFacilityClassByDFFeatureClassID(featureClass.FeatureClassID.ToString()); if (facC != null) { dr["FacilityClass"] = facC; } else { foreach (FacilityClass facTemp in FacilityClassManager.Instance.GetAllFacilityClass()) { if (featureClass.AliasName.Contains(facTemp.Alias)) { dr["FacilityClass"] = facTemp; break; } } } MajorClass mc = LogicDataStructureManage2D.Instance.GetMajorClassByDFFeatureClassID(featureClass.FeatureClassID.ToString()); if (mc != null) { dr["MajorClass"] = mc; } else { foreach (MajorClass mcTemp in LogicDataStructureManage2D.Instance.GetAllMajorClass()) { if (featureClass.AliasName.Contains(mcTemp.Alias)) { dr["MajorClass"] = mcTemp; break; } } } this._dt.Rows.Add(dr); } } }
private void calculateFactors(ISet <Clause> parentFactors) { nonTrivialFactors = CollectionFactory.CreateSet <Clause>(); IMap <Variable, Term> theta = CollectionFactory.CreateInsertionOrderedMap <Variable, Term>(); ICollection <Literal> lits = CollectionFactory.CreateQueue <Literal>(); for (int i = 0; i < 2; ++i) { lits.Clear(); if (i == 0) { // Look at the positive literals lits.AddAll(positiveLiterals); } else { // Look at the negative literals lits.AddAll(negativeLiterals); } for (int x = 0; x < lits.Size(); x++) { for (int y = x + 1; y < lits.Size(); y++) { Literal litX = lits.Get(x); Literal litY = lits.Get(y); theta.Clear(); IMap <Variable, Term> substitution = _unifier.unify( litX.getAtomicSentence(), litY.getAtomicSentence(), theta); if (null != substitution) { ICollection <Literal> posLits = CollectionFactory.CreateQueue <Literal>(); ICollection <Literal> negLits = CollectionFactory.CreateQueue <Literal>(); if (i == 0) { posLits.Add(_substVisitor.subst(substitution, litX)); } else { negLits.Add(_substVisitor.subst(substitution, litX)); } foreach (Literal pl in positiveLiterals) { if (pl == litX || pl == litY) { continue; } posLits.Add(_substVisitor.subst(substitution, pl)); } foreach (Literal nl in negativeLiterals) { if (nl == litX || nl == litY) { continue; } negLits.Add(_substVisitor.subst(substitution, nl)); } // Ensure the non trivial factor is standardized apart IMap <Variable, Term> renameSubst = _standardizeApart .standardizeApart(posLits, negLits, _saIndexical); Clause c = new Clause(posLits, negLits); c.setProofStep(new ProofStepClauseFactor(c, this, litX, litY, substitution, renameSubst)); if (isImmutable()) { c.setImmutable(); } if (!isStandardizedApartCheckRequired()) { c.setStandardizedApartCheckNotRequired(); } if (null == parentFactors) { c.calculateFactors(nonTrivialFactors); nonTrivialFactors.AddAll(c.getFactors()); } else { if (!parentFactors.Contains(c)) { c.calculateFactors(nonTrivialFactors); nonTrivialFactors.AddAll(c.getFactors()); } } } } } } factors = CollectionFactory.CreateSet <Clause>(); // Need to add self, even though a non-trivial // factor. See: slide 30 // http://logic.stanford.edu/classes/cs157/2008/lectures/lecture10.pdf // for example of incompleteness when // trivial factor not included. factors.Add(this); factors.AddAll(nonTrivialFactors); }
internal SortedSet(IMap impl) { this._impl = impl; }
protected void FillNameCollections(IEntityConfig entityConfig, ISet <String> memberNamesToIgnore, ISet <String> explicitBasicMemberNames, IList <IMemberConfig> embeddedMembers, IMap <String, IMemberConfig> nameToMemberConfig, IMap <String, IRelationConfig> nameToRelationConfig) { foreach (IMemberConfig memberConfig in entityConfig.GetMemberConfigIterable()) { String memberName = memberConfig.Name; if (memberConfig.Ignore) { memberNamesToIgnore.Add(memberName); memberNamesToIgnore.Add(memberName + "Specified"); continue; } explicitBasicMemberNames.Add(memberName); String[] parts = memberName.Split(dot); bool isEmbeddedMember = parts.Length > 1; if (isEmbeddedMember) { embeddedMembers.Add(memberConfig); memberNamesToIgnore.Add(parts[0]); memberNamesToIgnore.Add(parts[0] + "Specified"); continue; } nameToMemberConfig.Put(memberName, memberConfig); } foreach (IRelationConfig relationConfig in entityConfig.GetRelationConfigIterable()) { String relationName = relationConfig.Name; nameToRelationConfig.Put(relationName, relationConfig); } }
private bool checkSubsumes(Clause othC, IMap <string, ICollection <Literal> > thisToTry, IMap <string, ICollection <Literal> > othCToTry) { bool subsumes = false; ICollection <Term> thisTerms = CollectionFactory.CreateQueue <Term>(); ICollection <Term> othCTerms = CollectionFactory.CreateQueue <Term>(); // Want to track possible number of permuations ICollection <int> radices = CollectionFactory.CreateQueue <int>(); foreach (string literalName in thisToTry.GetKeys()) { int sizeT = thisToTry.Get(literalName).Size(); int sizeO = othCToTry.Get(literalName).Size(); if (sizeO > 1) { // The following is being used to // track the number of permutations // that can be mapped from the // other clauses like literals to this // clauses like literals. // i.e. n!/(n-r)! // where n=sizeO and r =sizeT for (int i = 0; i < sizeT; ++i) { int r = sizeO - i; if (r > 1) { radices.Add(r); } } } // Track the terms for this clause foreach (Literal tl in thisToTry.Get(literalName)) { thisTerms.AddAll(tl.getAtomicSentence().getArgs()); } } MixedRadixNumber permutation = null; long numPermutations = 1L; if (radices.Size() > 0) { permutation = new MixedRadixNumber(0, radices); numPermutations = permutation.GetMaxAllowedValue() + 1; } // Want to ensure none of the othCVariables are // part of the key set of a unification as // this indicates it is not a legal subsumption. ISet <Variable> othCVariables = _variableCollector .collectAllVariables(othC); IMap <Variable, Term> theta = CollectionFactory.CreateInsertionOrderedMap <Variable, Term>(); ICollection <Literal> literalPermuations = CollectionFactory.CreateQueue <Literal>(); for (long l = 0L; l < numPermutations; l++) { // Track the other clause's terms for this // permutation. othCTerms.Clear(); int radixIdx = 0; foreach (string literalName in thisToTry.GetKeys()) { int sizeT = thisToTry.Get(literalName).Size(); literalPermuations.Clear(); literalPermuations.AddAll(othCToTry.Get(literalName)); int sizeO = literalPermuations.Size(); if (sizeO > 1) { for (int i = 0; i < sizeT; ++i) { int r = sizeO - i; if (r > 1) { // If not a 1 to 1 mapping then you need // to use the correct permuation int numPos = permutation.GetCurrentNumeralValue(radixIdx); Literal lit = literalPermuations.Get(numPos); literalPermuations.Remove(lit); othCTerms.AddAll(lit.getAtomicSentence().getArgs()); radixIdx++; } else { // is the last mapping, therefore // won't be on the radix othCTerms.AddAll(literalPermuations.Get(0).getAtomicSentence().getArgs()); } } } else { // a 1 to 1 mapping othCTerms.AddAll(literalPermuations.Get(0) .getAtomicSentence().getArgs()); } } // Note: on unifier // unifier.unify(P(w, x), P(y, z)))={w=y, x=z} // unifier.unify(P(y, z), P(w, x)))={y=w, z=x} // Therefore want this clause to be the first // so can do the othCVariables check for an invalid // subsumes. theta.Clear(); if (null != _unifier.unify(thisTerms, othCTerms, theta)) { bool containsAny = false; foreach (Variable v in theta.GetKeys()) { if (othCVariables.Contains(v)) { containsAny = true; break; } } if (!containsAny) { subsumes = true; break; } } // If there is more than 1 mapping // keep track of where I am in the // possible number of mapping permutations. if (null != permutation) { permutation.Increment(); } } return(subsumes); }
protected Member HandleRelationConfig(Type realType, IRelationConfig relationConfig, IMap <String, Member> relationConfigToInfoItem) { if (relationConfig == null) { return(null); } Member member = relationConfigToInfoItem.Get(relationConfig.Name); if (member != null) { return(member); } member = IntermediateMemberTypeProvider.GetIntermediateRelationMember(realType, relationConfig.Name); if (member == null) { throw new Exception("No member with name '" + relationConfig.Name + "' found on entity type '" + realType.Name + "'"); } relationConfigToInfoItem.Put(relationConfig.Name, member); return(member); }
// Note: Applies binary resolution rule // Note: returns a set with an empty clause if both clauses // are empty, otherwise returns a set of binary resolvents. public ISet <Clause> binaryResolvents(Clause othC) { ISet <Clause> resolvents = CollectionFactory.CreateSet <Clause>(); // Resolving two empty clauses // gives you an empty clause if (isEmpty() && othC.isEmpty()) { resolvents.Add(new Clause()); return(resolvents); } // Ensure Standardized Apart // Before attempting binary resolution othC = saIfRequired(othC); ICollection <Literal> allPosLits = CollectionFactory.CreateQueue <Literal>(); ICollection <Literal> allNegLits = CollectionFactory.CreateQueue <Literal>(); allPosLits.AddAll(this.positiveLiterals); allPosLits.AddAll(othC.positiveLiterals); allNegLits.AddAll(this.negativeLiterals); allNegLits.AddAll(othC.negativeLiterals); ICollection <Literal> trPosLits = CollectionFactory.CreateQueue <Literal>(); ICollection <Literal> trNegLits = CollectionFactory.CreateQueue <Literal>(); ICollection <Literal> copyRPosLits = CollectionFactory.CreateQueue <Literal>(); ICollection <Literal> copyRNegLits = CollectionFactory.CreateQueue <Literal>(); for (int i = 0; i < 2; ++i) { trPosLits.Clear(); trNegLits.Clear(); if (i == 0) { // See if this clauses positives // unify with the other clauses // negatives trPosLits.AddAll(this.positiveLiterals); trNegLits.AddAll(othC.negativeLiterals); } else { // Try the other way round now trPosLits.AddAll(othC.positiveLiterals); trNegLits.AddAll(this.negativeLiterals); } // Now check to see if they resolve IMap <Variable, Term> copyRBindings = CollectionFactory.CreateInsertionOrderedMap <Variable, Term>(); foreach (Literal pl in trPosLits) { foreach (Literal nl in trNegLits) { copyRBindings.Clear(); if (null != _unifier.unify(pl.getAtomicSentence(), nl.getAtomicSentence(), copyRBindings)) { copyRPosLits.Clear(); copyRNegLits.Clear(); bool found = false; foreach (Literal l in allPosLits) { if (!found && pl.Equals(l)) { found = true; continue; } copyRPosLits.Add(_substVisitor.subst(copyRBindings, l)); } found = false; foreach (Literal l in allNegLits) { if (!found && nl.Equals(l)) { found = true; continue; } copyRNegLits.Add(_substVisitor.subst(copyRBindings, l)); } // Ensure the resolvents are standardized apart IMap <Variable, Term> renameSubstitituon = _standardizeApart .standardizeApart(copyRPosLits, copyRNegLits, _saIndexical); Clause c = new Clause(copyRPosLits, copyRNegLits); c.setProofStep(new ProofStepClauseBinaryResolvent(c, pl, nl, this, othC, copyRBindings, renameSubstitituon)); if (isImmutable()) { c.setImmutable(); } if (!isStandardizedApartCheckRequired()) { c.setStandardizedApartCheckNotRequired(); } resolvents.Add(c); } } } } return(resolvents); }