Ejemplo n.º 1
0
        public static ILegendCommand CreateExportAsShapefile(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDownload,
                Layer      = layer,
                ToolTip    = _exportAsShapefileToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var fileName = await map.DialogService.ShowSaveFileDialogAsync("*.shp|*.shp", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(fileName))
                    {
                        return;
                    }

                    layer.ExportAsShapefile(fileName);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 2
0
    //攻撃処理
    public void Attack(MapPresenter m, Dictionary <int, CharacterPresenter> characterListPresenter)
    {
        Vector3 pos = status.position + status.direction;

        if (pos.x < 0 || pos.z < 0)
        {
            return;
        }

        var vector2Int = new Vector2Int((int)pos.x, (int)pos.z);

        if (m.GetTileModel(vector2Int).charaType == TileModel.CharaType.Player ||
            m.GetTileModel(vector2Int).charaType == TileModel.CharaType.Enemy)
        {
            CharacterPresenter characterPresenter =
                characterListPresenter
                .FirstOrDefault(presenter => presenter.Key == m.GetTileModel(vector2Int).guid).Value;

            int damage = CalcAction.CalcAttack(status, characterPresenter.status);

            Debug.Log("Attack Damage : " + damage);
            characterPresenter.CalcHp(damage);
            Debug.Log("After Hp : " + characterPresenter.status.hp);

            ActionLogPresenter.Instance.ShowView();
            ActionLogPresenter.Instance.AddLog(LogType.Attack, new string[] { status.name, characterPresenter.status.name, damage.ToString() });
            if (characterPresenter.status.hp <= 0)
            {
                characterPresenter.Death();
            }
        }
        SetIsAction(true);

        characterView.Attack();
    }
Ejemplo n.º 3
0
        //public static Func<MapPresenter, FeatureTableCommand> CreateZoomToExtentCommandFunc = (presenter) => CreateZoomToExtentCommand(presenter);
        public static FeatureTableCommand CreateZoomToExtentCommand(MapPresenter map)
        {
            var result = new FeatureTableCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarMagnify,
                //Layer = layer.AssociatedLayer,
                ToolTip = "محدودهٔ عوارض"
            };

            result.Command = new RelayCommand((param) =>
            {
                var layer = param as ISelectedLayer;

                if (layer == null || map == null)
                {
                    return;
                }

                var features = layer.GetHighlightedFeatures();

                var extent = BoundingBox.GetMergedBoundingBox(features.Select(f => f.TheSqlGeometry.GetBoundingBox()));

                map.ZoomToExtent(extent, false, () => { TryFlashPoint(map, features); });
            });

            return(result);
        }
Ejemplo n.º 4
0
        public static ILegendCommand CreateExportAsPng(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarImage,
                Layer      = layer,
                ToolTip    = _exportAsBitmapToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var fileName = await map.DialogService.ShowSaveFileDialogAsync("*.png|*.png", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(fileName))
                    {
                        return;
                    }

                    layer.SaveAsPng(fileName, map.CurrentExtent, map.ActualWidth, map.ActualHeight, map.MapScale);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 5
0
 private static void TryFlashPoint(MapPresenter map, IEnumerable <ISqlGeometryAware> point)
 {
     if (point?.Count() == 1 && point.First().TheSqlGeometry.GetOpenGisType() == Microsoft.SqlServer.Types.OpenGisGeometryType.Point)
     {
         map.FlashHighlightedFeatures(point.First());
     }
 }
Ejemplo n.º 6
0
        // ***************** Simplify by Area ********
        // *******************************************
        public static ILegendCommand CreateSimplifyByAreaCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarFlag,
                Layer      = layer,
                ToolTip    = "ساده‌سازی روش مساحت",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var simplified = layer.Geometry.Simplify(SimplificationType.AdditiveByArea, map.CurrentZoomLevel, new SimplificationParamters()
                    {
                        Retain3Points = true
                    });
                    //VisualSimplification.sim layer.Geometry.Simplify()
                    map.AddDrawingItem(simplified, $"{layer.LayerName} simplified-{map.CurrentZoomLevel}");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 7
0
        // ***************** Duplicate ***************
        // *******************************************
        public static ILegendCommand CreateCloneDrawingItemCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarPageCopy,
                Layer      = layer,
                ToolTip    = "ایجاد کپی از عارضه",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var cloned = layer.Geometry.Clone();

                    map.AddDrawingItem(cloned, $"{layer.LayerName} cloned-{map.CurrentZoomLevel}");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 8
0
        // ***************** Boundary ****************
        // *******************************************
        public static ILegendCommand CreateGetBoundaryCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.boundary,
                Layer      = layer,
                ToolTip    = "مرز",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var geometry = layer.Geometry.AsSqlGeometry().STBoundary();

                    map.AddDrawingItem(geometry.AsGeometry(), $"{layer.LayerName}-Boundary");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 9
0
        // ***************** Extract points **********
        // *******************************************
        public static ILegendCommand CreateBreakIntoPointsCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.extractPoints,
                Layer      = layer,
                ToolTip    = "تفکیک به نقاط",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var pointCollection = IRI.Ket.SqlServerSpatialExtension.SqlSpatialUtility.MakePointCollection(layer.Geometry.GetAllPoints());

                    map.AddDrawingItem(pointCollection.AsGeometry(), $"{layer.LayerName} Points");
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 10
0
        // ***************** Break into geometries ***
        // *******************************************
        public static ILegendCommand CreateBreakIntoGeometriesCommand(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.SegoePrint.extractGeometries,
                Layer      = layer,
                ToolTip    = "تفکیک به هندسه",
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var geometries = layer.Geometry.AsSqlGeometry().GetGeometries();

                    var counter = 0;

                    foreach (var geo in geometries)
                    {
                        map.AddDrawingItem(geo.AsGeometry(), $"{layer.LayerName} Geometry #{counter++}");
                    }
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 11
0
        public static ILegendCommand CreateExportAsGeoJson(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDownload,
                Layer      = layer,
                ToolTip    = _exportAsGeoJsonToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var fileName = await map.DialogService.ShowSaveFileDialogAsync("*.json|*.json", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(fileName))
                    {
                        return;
                    }

                    // 1400.02.31
                    // به خاطر خروجی برنامه البرز نگار
                    // چون در سایت ژئوجی‌سان دات آی‌او
                    // بارگذاری می شه خروجی‌ها
                    layer.ExportAsGeoJson(fileName, true);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 12
0
        // ***************** Export As Shapefile *****
        // *******************************************
        public static ILegendCommand CreateExportDrawingItemLayerAsShapefile(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Others.shapefile,
                Layer      = layer,
                ToolTip    = _saveAsShapefileToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var file = map.DialogService.ShowSaveFileDialog("*.shp|*.shp", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(file))
                    {
                        return;
                    }

                    var esriShape = layer.Geometry.AsSqlGeometry().AsEsriShape();

                    IRI.Ket.ShapefileFormat.Shapefile.Save(file, new List <Ket.ShapefileFormat.EsriType.IEsriShape>()
                    {
                        esriShape
                    }, true, true);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 13
0
    public void Generate(MapPresenter mapPresenter, ItemModel model)
    {
        // item object作成
        GameObject res = Resources.Load("Object/" + model.modelName.Replace('_', '/')) as GameObject;
        Vector2Int pos = mapPresenter.GetPopPoint();
        GameObject obj = Object.Instantiate(res, new Vector3(pos.x, 0, pos.y), Quaternion.identity) as GameObject;

        obj.name             = "Item;" + serialGuid;
        obj.layer            = 9;
        obj.transform.parent = transform;

        // item model作成
        ItemPresenter itemPresenter = obj.AddComponent <ItemPresenter>();

        itemPresenter.itemView       = obj.AddComponent <ItemView>();
        itemPresenter.itemView.model = obj;

        itemPresenter.Initialize(model, serialGuid);
        itemPresenter.SetMapData(
            mapPresenter.GetTileModel(pos.x, pos.y).floorId,
            new Vector3(pos.x, 0, pos.y),
            new Vector3(0, 0, -1)
            );

        itemListPresenter[serialGuid] = itemPresenter;
        itemListObject[serialGuid]    = obj;
        serialGuid++;

        mapPresenter.SetItemModel(pos.x, pos.y, itemPresenter.status);
    }
 public MapLoaderControlViewModel(IMapLoadingService MapLoadingService, MapPresenter MapPresenter, IMappingService MappingService,
                                  ITrackSource TrackSource)
 {
     _mapLoadingService = MapLoadingService;
     _mapPresenter = MapPresenter;
     _mappingService = MappingService;
     _trackSource = TrackSource;
     _load = ReactiveCommand.CreateAsyncTask((_, c) => LoadMap());
 }
Ejemplo n.º 15
0
        public static LegendToggleCommand CreateToggleLayerLabelCommand(MapPresenter map, ILayer layer, LabelParameters labels)
        {
            LegendToggleCommand result = new LegendToggleCommand();

            result.PathMarkup           = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarTextSerif;
            result.NotCheckedPathMarkup = IRI.Jab.Common.Assets.ShapeStrings.AppbarExtension.appbarTextSerifNone;
            result.ToolTip = "نمایش برچسب عوارض";
            result.Layer   = layer;

            EventHandler <CustomEventArgs <LabelParameters> > labels_IsInScaleRangeChanged = (sender, e) =>
            {
                if (e.Arg != null)
                {
                    result.IsEnabled = e.Arg.IsInScaleRange;
                }
            };

            EventHandler <CustomEventArgs <LabelParameters> > layer_OnLabelChanged = (sender, e) =>
            {
                if (e.Arg != null)
                {
                    e.Arg.OnIsInScaleRangeChanged -= labels_IsInScaleRangeChanged;
                    e.Arg.OnIsInScaleRangeChanged += labels_IsInScaleRangeChanged;
                }
            };

            layer.OnLabelChanged -= layer_OnLabelChanged;
            layer.OnLabelChanged += layer_OnLabelChanged;

            layer.Labels = labels;

            result.Command = new RelayCommand(param =>
            {
                if (layer == null)
                {
                    return;
                }

                if (result.IsSelected)
                {
                    result.Layer.Labels.IsOn = true;

                    //map.Refresh();
                }
                else
                {
                    result.Layer.Labels.IsOn = false;

                    //map.Refresh();
                }

                map.RefreshLayerVisibility(result.Layer);
            });

            return(result);
        }
Ejemplo n.º 16
0
    public void CalcMove(float x, float z, MapPresenter mapPresenter)
    {
        isMove = true;
        Rigidbody transform   = characterView.GetTransForm();
        Vector3   nowPosition = transform.position;

        targetPosition.x = x / 200 + nowPosition.x;
        targetPosition.z = z / 200 + nowPosition.z;

        characterView.Run(true);
    }
Ejemplo n.º 17
0
        public static FeatureTableCommand CreateExportAsDrawingLayersCommand(MapPresenter map)
        {
            var result = new FeatureTableCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarVectorPenAdd,
                //Layer = layer.AssociatedLayer,
                ToolTip = "انتقال به ترسیم‌ها"
            };

            result.Command = new RelayCommand((param) =>
            {
                var layer = param as ISelectedLayer;

                if (layer == null || map == null)
                {
                    return;
                }

                var features = layer.GetHighlightedFeatures();

                if (features.IsNullOrEmpty())
                {
                    return;
                }

                foreach (var feature in features)
                {
                    map.AddDrawingItem(feature.TheSqlGeometry.AsGeometry());
                }

                //
                //List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();

                //foreach (var item in features)
                //{
                //    if (item is SqlFeature feature)
                //    {
                //        rows.Add(feature.Attributes);
                //    }
                //}

                ////گرفتن مسیر فایل
                //var fileName = map.SaveFile("*.xlsx|*.xlsx");

                //if (string.IsNullOrWhiteSpace(fileName))
                //    return;

                //Ket.OfficeFormat.ExcelHelper.WriteDictionary(rows, fileName, "Sheet1", null, null);
            });

            return(result);
        }
Ejemplo n.º 18
0
 private void Awake()
 {
     playerPresenter = GetComponent<PlayerPresenter>();    
     mapPresenter = GetComponent<MapPresenter>();
     enemyPresenter = GetComponent<EnemyPresenter>();
     bulletPresenter = GetComponent<BulletPresenter>();
     gunPresenter = GetComponent<GunPresenter>();
     playerPresenter.Setup(playerModel,gunModel);
     enemyPresenter.Setup(enemyModel,gunModel);
     bulletPresenter.Setup(bulletModel);
     gunPresenter.Setup(gunModel);
     mapPresenter.Setup(mapModel);
 }
Ejemplo n.º 19
0
    public void Generate(MapPresenter mapPresenter)
    {
        for (int x = 0; x < num; x++)
        {
            GameObject obj = Object.Instantiate(Resources.Load("Object/Map/Stairs")) as GameObject;
            Vector2Int pos = mapPresenter.GetPopPoint();

            obj.transform.position = new Vector3(pos.x, 0, pos.y);
            obj.layer = 9;

            stairsList.Add(obj);
            //mapに配置
            mapPresenter.GetTileModel(pos.x, pos.y).tileType = TileModel.TileType.Stairs;
        }
    }
Ejemplo n.º 20
0
        public static ILegendCommand CreateRemoveLayer(MapPresenter map, ILayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDelete,
                Layer      = layer,
                ToolTip    = "حذف لایه",
            };

            result.Command = new RelayCommand(param =>
            {
                map.ClearLayer(layer, true);
            });

            return(result);
        }
Ejemplo n.º 21
0
        // ***************** Edit ********************
        // *******************************************
        public static ILegendCommand CreateEditDrawingItemLayer(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarEdit,
                Layer      = layer,
                ToolTip    = _editToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                var editResult = await map.EditAsync(layer.Geometry, map.MapSettings.EditingOptions);

                if (!(editResult.IsCanceled == true))
                {
                    map.ClearLayer(layer);
                }

                if (editResult.HasNotNullResult())
                {
                    layer.Geometry = editResult.Result;

                    //shapeItem.AssociatedLayer = new VectorLayer(shapeItem.Title, new List<SqlGeometry>() { editResult.Result.AsSqlGeometry() }, VisualParameters.GetRandomVisualParameters(), LayerType.Drawing, RenderingApproach.Default, RasterizationApproach.DrawingVisual);

                    map.ClearLayer(layer);
                    map.AddLayer(layer);
                    //map.SetLayer(layer);

                    // 1400.03.08- remove highlighted geometry
                    layer.IsSelectedInToc = false;
                    //map.ClearLayer(layer.HighlightGeometryKey.ToString(), true, true);

                    //map.Refresh();

                    if (layer.OriginalSource != null)
                    {
                        layer.OriginalSource.Update(new SqlFeature(editResult.Result.AsSqlGeometry())
                        {
                            Id = layer.Id
                        });
                    }
                }
            });

            return(result);
        }
Ejemplo n.º 22
0
        public static Action GetDefaultGoToAction(Window ownerWindow, MapPresenter mapPresenter)
        {
            Action result = new Action(() =>
            {
                var gotoView = new IRI.Jab.Controls.View.Input.GoToMetroWindow();

                var gotoPresenter = IRI.Jab.Controls.Presenter.GoToPresenter.Create(mapPresenter);

                gotoView.DataContext           = gotoPresenter;
                gotoView.Owner                 = ownerWindow;
                gotoView.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                gotoView.Show();

                gotoPresenter.SelectDefaultMenu();
            });

            return(result);
        }
Ejemplo n.º 23
0
        // ***************** Remove ******************
        // *******************************************
        public static ILegendCommand CreateRemoveDrawingItemLayer(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDelete,
                Layer      = layer,
                ToolTip    = _removeToolTip,
            };

            result.Command = new RelayCommand(param =>
            {
                map.RemoveDrawingItem(layer);

                //map.Refresh();
            });

            return(result);
        }
Ejemplo n.º 24
0
        public static ILegendCommand CreateSelectByDrawing <T>(MapPresenter map, VectorLayer layer) where T : class, ISqlGeometryAware
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarVectorPenConvert,
                Layer      = layer,
                ToolTip    = "انتخاب عوارض محدودهٔ ترسیم",
            };

            result.Command = new RelayCommand(async param =>
            {
                var options = EditableFeatureLayerOptions.CreateDefaultForDrawing(false, false);

                options.IsOptionsAvailable = false;

                var drawingResult = await map.GetDrawingAsync(Model.DrawMode.Polygon, options);

                if (!drawingResult.HasNotNullResult())
                {
                    return;
                }

                var features = layer.GetFeatures <T>(drawingResult.Result.AsSqlGeometry());

                if (features == null)
                {
                    return;
                }

                var newLayer = new Model.Map.SelectedLayer <T>(layer)
                {
                    ShowSelectedOnMap = true
                };

                if (features != null)
                {
                    newLayer.Features = new System.Collections.ObjectModel.ObservableCollection <T>(features);
                }

                map.AddSelectedLayer(newLayer);
            });

            return(result);
        }
Ejemplo n.º 25
0
        public static FeatureTableCommand CreateExportToExcelCommand(MapPresenter map)
        {
            var result = new FeatureTableCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarPageExcel,
                //Layer = layer.AssociatedLayer,
                ToolTip = "خروجی اکسل"
            };

            result.Command = new RelayCommand((param) =>
            {
                var layer = param as ISelectedLayer;

                if (layer == null || map == null)
                {
                    return;
                }

                var features = layer.GetSelectedFeatures();

                //
                List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();

                foreach (var item in features)
                {
                    if (item is SqlFeature feature)
                    {
                        rows.Add(feature.Attributes);
                    }
                }

                //گرفتن مسیر فایل
                var fileName = map.DialogService.ShowSaveFileDialog("*.xlsx|*.xlsx", null, layer.LayerName);

                if (string.IsNullOrWhiteSpace(fileName))
                {
                    return;
                }

                Ket.OfficeFormat.ExcelHelper.WriteDictionary(rows, fileName, "Sheet1", null, null);
            });

            return(result);
        }
Ejemplo n.º 26
0
        private void InitPresentersAndViews()
        {
            using (PresenterFactory.BeginSharedPresenterTransaction(StructureMapContainerInit(), new BaseForm()))
            {
                var mocks = new Mockery();

                var chartView = DataHelper.GetView <IChartView>(mocks);

                m_ChartPresenter = DataHelper.GetPresenter <ChartPresenter>(chartView);
                Assert.IsNotNull(m_ChartPresenter);

                IPivotDetailView pivotView = PivotPresenterReportTests.GetPivotView(mocks);
                m_PivotDetailPresenter = DataHelper.GetPresenter <PivotDetailPresenter>(pivotView);
                Assert.IsNotNull(m_PivotDetailPresenter);

                var mapView = DataHelper.GetView <IMapView>(mocks);
                m_MapPresenter = DataHelper.GetPresenter <MapPresenter>(mapView);
                Assert.IsNotNull(m_MapPresenter);

                var layoutInfoView = DataHelper.GetView <IPivotInfoDetailView>(mocks);
                m_PivotInfoPresenter = DataHelper.GetPresenter <PivotInfoPresenter>(layoutInfoView);
                Assert.IsNotNull(m_PivotInfoPresenter);

                var viewDetailView = DataHelper.GetView <IViewDetailView>(mocks);
                m_ViewDetailPresenter = DataHelper.GetPresenter <ViewDetailPresenter>(viewDetailView);
                Assert.IsNotNull(m_ViewDetailPresenter);



                var layoutDetailView = DataHelper.GetView <ILayoutDetailView>(mocks);

                m_LayoutDetailPresenter = DataHelper.GetPresenter <LayoutDetailPresenter>(layoutDetailView);
                Assert.IsNotNull(m_LayoutDetailPresenter);

                var pivotGridView = mocks.NewMock <IAvrPivotGridView>();
                Expect.Once.On(pivotGridView).EventAdd("SendCommand", Is.Anything);
                m_PivotGridPresenter = PresenterFactory.SharedPresenter[pivotGridView] as AvrPivotGridPresenter;
                Assert.IsNotNull(m_PivotGridPresenter);


                mocks.VerifyAllExpectationsHaveBeenMet();
            }
        }
Ejemplo n.º 27
0
        public static ILegendCommand CreateClearSelected(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup       = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarClose,
                Layer            = layer,
                ToolTip          = "پاک کردن عوارض انتخابی",
                IsCommandVisible = false,
            };

            result.Command = new RelayCommand(param =>
            {
                map.RemoveSelectedLayer(layer);
            });

            layer.OnSelectedFeaturesChanged += (sender, e) => { result.IsCommandVisible = e.Arg.HasSelectedFeatures; };

            return(result);
        }
Ejemplo n.º 28
0
        public void Build()
        {
            Result = new MapPresenter();

            Result.Parent = null;

            TextFieldPresenter classNameFieldPresenter = new TextFieldPresenter();
            classNameFieldPresenter.FormatString = "Class Name: {0}";

            Result["ClassNamePresentation"] = classNameFieldPresenter;

            AddFieldBinding(classNameFieldPresenter, "ClassName");

            CollectionPresenter studentsPresenter = new CollectionPresenter();

            Result["StudentsPresenter"] = studentsPresenter;

            AddCollectionBinding(studentsPresenter, "People");
        }
Ejemplo n.º 29
0
        public static LegendCommand CreateZoomToExtentCommand(MapPresenter map, ILayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarMagnify,
                Layer      = layer,
                ToolTip    = "محدودهٔ لایه"
            };

            result.Command = new RelayCommand((param) =>
            {
                if (layer == null || map == null)
                {
                    return;
                }

                map.ZoomToExtent(result.Layer.Extent, false);
            });

            return(result);
        }
Ejemplo n.º 30
0
        // ***************** Export As GeoJson *******
        // *******************************************
        public static ILegendCommand CreateExportDrawingItemLayerAsGeoJson(MapPresenter map, DrawingItemLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Others.json,
                Layer      = layer,
                ToolTip    = _saveAsGeoJsonToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var file = map.DialogService.ShowSaveFileDialog("*.json|*.json", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(file))
                    {
                        return;
                    }

                    var feature = GeoJsonFeature.Create(layer.Geometry.Project(SrsBases.GeodeticWgs84).AsGeoJson());

                    GeoJsonFeatureSet featureSet = new GeoJsonFeatureSet()
                    {
                        Features = new List <GeoJsonFeature>()
                        {
                            feature
                        }, TotalFeatures = 1
                    };

                    featureSet.Save(file, false, false);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }
Ejemplo n.º 31
0
        public static GoToPresenter Create(MapPresenter mapPresenter)
        {
            var gotoPresenter = new GoToPresenter(
                p =>
            {
                var webMercatorPoint = MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.PanTo(webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            },
                p =>
            {
                var webMercatorPoint = IRI.Ham.CoordinateSystem.MapProjection.MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.ZoomToLevelAndCenter(13, webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            });

            return(gotoPresenter);
        }
Ejemplo n.º 32
0
    private Vector2Int[] GetDestinationWayList(Vector2Int from, Vector2Int to, MapPresenter mapPresenter, CharacterPresenter characterPresenter)
    {
        AStarCost nowNode = new AStarCost();

        nowNode.position = from;

        nowNode.cost         = 0;
        nowNode.estimateCost = EstimateCost(nowNode.position, to);
        nowNode.score        = nowNode.cost + nowNode.estimateCost;

        var cacheAStarCostList = new List <AStarCost>()
        {
            nowNode
        };
        var routeAStarList = new List <AStarCost>();

        GetPositionAStar(nowNode, to, ref routeAStarList, ref cacheAStarCostList, mapPresenter, characterPresenter);
        if (routeAStarList.Count > 0)
        {
            routeAStarList.Reverse();
            return(routeAStarList.Select(_ => _.position).ToArray());
        }
        return(new Vector2Int[] { });
    }
Ejemplo n.º 33
0
        private void Dispose(Boolean disposing)
        {
            if (!_disposed && disposing)
            {
                WebMapRenderer = null;

                if (_presenter != null)
                {
                    _presenter.Dispose();
                }

                _presenter = null;
                _disposed = true;
            }
        }
Ejemplo n.º 34
0
        MapPresenter GetPersonMap(Person person)
        {
            MapPresenter result = new MapPresenter();

            result["FirstName"] = new TextFieldPresenter
            {
                TheValue = person.FirstName,
                FormatString = "FirstName: {0}"
            };

            result["LastName"] = new TextFieldPresenter
            {
                TheValue = person.LastName,
                FormatString = "LastName: {0}"
            };

            return result;
        }