public virtual LayoutMap UpdateLayoutMap(LayoutMap entity) { if (entity.IsTransient()) { return(entity); } LayoutMap other = GetLayoutMap(entity.LayoutMapId); if (entity.Equals(other)) { return(entity); } string sql = @"Update LayoutMap set [LayoutMapGUID]=@LayoutMapGUID , [LayoutID]=@LayoutID , [PageTypeID]=@PageTypeID , [PageID]=@PageID , [CreatedOn]=@CreatedOn where LayoutMapID=@LayoutMapID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@LayoutMapID", entity.LayoutMapId) , new SqlParameter("@LayoutMapGUID", entity.LayoutMapGuid) , new SqlParameter("@LayoutID", entity.LayoutId) , new SqlParameter("@PageTypeID", entity.PageTypeId) , new SqlParameter("@PageID", entity.PageId) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetLayoutMap(entity.LayoutMapId)); }
/// <summary> /// Adds map element to the new layout. /// </summary> /// <param name="mapScale">The map scale.</param> /// <param name="extents">The extents.</param> private void AddMapElement(int mapScale, IEnvelope extents) { var map = _context.Map; var mapElement = new LayoutMap(); mapElement.Initialize(map, View.LayoutControl); mapElement.IsMain = true; mapElement.TileProvider = _context.Map.TileProvider; mapElement.LocationF = new PointF(PrintingConstants.DefaultMapOffset, PrintingConstants.DefaultMapOffset); mapElement.DrawTiles = map.Tiles.Visible; // calc the necessary size in paper coordinates GeoSize size; if (map.GetGeodesicSize(extents, out size)) { mapElement.SizeF = LayoutScaleHelper.CalcMapSize(mapScale, size, extents.Width / extents.Height); mapElement.Envelope = extents.Clone(); mapElement.Initialized = true; View.LayoutControl.AddToLayout(mapElement); View.LayoutControl.UpdateLayout(); View.LayoutControl.ZoomFitToScreen(); } }
/// <summary> /// 获取图片留 /// </summary> /// <returns></returns> public Stream GetImageStream() { MemoryStream memoryStream = new MemoryStream(); LayoutMap.Save(memoryStream, ImageFormat.Jpeg); return(memoryStream); }
private void AddMap() { var map = new LayoutMap(); map.Initialize(_map, _layoutControl); map.Envelope = _view.Model.Extents; map.TileProvider = _context.Map.TileProvider; _layoutControl.AddElementWithMouse(map); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { ApplicationSettingMap.Map(modelBuilder.Entity <ApplicationSetting>()); ApplicationEntitiesMap.Map(modelBuilder.Entity <ApplicationEntities>()); ApplicationProcessMap.Map(modelBuilder.Entity <ApplicationProcess>()); ApplicationsMap.Map(modelBuilder.Entity <Applications>()); DataPropertiesMap.Map(modelBuilder.Entity <DataProperties>()); DataTypesMap.Map(modelBuilder.Entity <DataTypes>()); EntitiesMap.Map(modelBuilder.Entity <EF.Entities.Entities>()); EntityPropertiesMap.Map(modelBuilder.Entity <EntityProperties>()); EntityRelationshipsMap.Map(modelBuilder.Entity <EntityRelationships>()); EntityViewMap.Map(modelBuilder.Entity <EntityView>()); EntityViewEntityPropertiesMap.Map(modelBuilder.Entity <EntityViewEntityProperties>()); EntityViewPropertiesMap.Map(modelBuilder.Entity <EntityViewProperties>()); EntityViewPropertyFunctionMap.Map(modelBuilder.Entity <EntityViewPropertyFunction>()); EntityViewPropertyFunctionParameterMap.Map(modelBuilder.Entity <EntityViewPropertyFunctionParameter>()); EntityViewViewPropertiesMap.Map(modelBuilder.Entity <EntityViewViewProperties>()); FunctionBodyMap.Map(modelBuilder.Entity <FunctionBody>()); FunctionParametersMap.Map(modelBuilder.Entity <FunctionParameters>()); FunctionReturnTypeMap.Map(modelBuilder.Entity <FunctionReturnType>()); FunctionsMap.Map(modelBuilder.Entity <Functions>()); FunctionSetFunctionsMap.Map(modelBuilder.Entity <FunctionSetFunctions>()); FunctionSetsMap.Map(modelBuilder.Entity <FunctionSets>()); LayersMap.Map(modelBuilder.Entity <Layers>()); LayoutMap.Map(modelBuilder.Entity <Layout>()); ModelTypesMap.Map(modelBuilder.Entity <ModelTypes>()); OperatorsMap.Map(modelBuilder.Entity <Operators>()); ParametersMap.Map(modelBuilder.Entity <Parameters>()); PartsMap.Map(modelBuilder.Entity <Parts>()); PresentationPropertiesMap.Map(modelBuilder.Entity <PresentationProperties>()); PrimaryKeyOptionsMap.Map(modelBuilder.Entity <PrimaryKeyOptions>()); ProcessMap.Map(modelBuilder.Entity <Process>()); ProcessStepsMap.Map(modelBuilder.Entity <ProcessSteps>()); ProcessStepScreensMap.Map(modelBuilder.Entity <ProcessStepScreens>()); ProjectsMap.Map(modelBuilder.Entity <Projects>()); RelationshipTypesMap.Map(modelBuilder.Entity <RelationshipTypes>()); ScreenLayoutsMap.Map(modelBuilder.Entity <ScreenLayouts>()); ScreenPartsMap.Map(modelBuilder.Entity <ScreenParts>()); ScreensMap.Map(modelBuilder.Entity <Screens>()); ScreenViewsMap.Map(modelBuilder.Entity <ScreenViews>()); SettingsMap.Map(modelBuilder.Entity <Settings>()); SettingsNamesMap.Map(modelBuilder.Entity <SettingsNames>()); StateMachinesMap.Map(modelBuilder.Entity <StateMachines>()); StateMachineStatesMap.Map(modelBuilder.Entity <StateMachineStates>()); StateMachineTriggersMap.Map(modelBuilder.Entity <StateMachineTriggers>()); StatesMap.Map(modelBuilder.Entity <States>()); StepsMap.Map(modelBuilder.Entity <Steps>()); TestValuesMap.Map(modelBuilder.Entity <TestValues>()); TriggersMap.Map(modelBuilder.Entity <Triggers>()); ViewEntityMap.Map(modelBuilder.Entity <ViewEntity>()); ViewsMap.Map(modelBuilder.Entity <Views>()); }
/// <summary> /// 初始化布局 /// </summary> /// <param name="r"></param> /// <param name="c"></param> public void InitLayout(int r, int c) { Layout = new int[Row, Col]; GameState = FiveGameState.Init; MaxPlayerCount = 2; int leftIndexWidth = Pixel; StartX = leftIndexWidth; StartY = TitleHeight + leftIndexWidth; int width = 0, height = 0; width = leftIndexWidth * 2 + Pixel * Col; height = TitleHeight + leftIndexWidth * 2 + Pixel * Row; if (LayoutMap != null) { this.Draw.Dispose(); LayoutMap.Dispose(); } //创建图片 LayoutMap = new Bitmap(width, height); Draw = Graphics.FromImage(LayoutMap); SolidBrush black = new SolidBrush(Color.Black); Pen p = new Pen(black, 2); //背景 Draw.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, width, height)); for (int i = 0; i <= Row; i++) { int posHei = StartY + i * Pixel; if (i != Row) { Draw.DrawString((i + 1).ToString(), new Font(FontFamily.GenericMonospace, 10), black, new PointF(0, posHei)); Draw.DrawString((i + 1).ToString(), new Font(FontFamily.GenericMonospace, 10), black, new PointF(LayoutMap.Width - leftIndexWidth, posHei)); } Draw.DrawLine(p, new Point(StartX, posHei), new Point(LayoutMap.Width - leftIndexWidth, posHei)); } for (int i = 0; i <= Col; i++) { int posWid = StartX + i * Pixel; if (i != Col) { Draw.DrawString((i + 1).ToString(), new Font(FontFamily.GenericMonospace, 10), black, new PointF(posWid, TitleHeight)); Draw.DrawString((i + 1).ToString(), new Font(FontFamily.GenericMonospace, 10), black, new PointF(posWid, LayoutMap.Height - leftIndexWidth)); } Draw.DrawLine(p, new Point(posWid, StartY), new Point(posWid, LayoutMap.Height - Pixel)); } }
public virtual LayoutMap LayoutMapFromDataRow(DataRow dr) { if (dr == null) { return(null); } LayoutMap entity = new LayoutMap(); entity.LayoutMapId = (System.Int32)dr["LayoutMapID"]; entity.LayoutMapGuid = (System.Guid)dr["LayoutMapGUID"]; entity.LayoutId = (System.Int32)dr["LayoutID"]; entity.PageTypeId = (System.Int32)dr["PageTypeID"]; entity.PageId = (System.Int32)dr["PageID"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
internal static string Generate(string reportPath, List <LayoutReport> testReport) { ReportRequest request = new ReportRequest(); List <LayoutMap> maps = new List <LayoutMap>(); foreach (LayoutReport rep in testReport) { LayoutMap map = new LayoutMap(); map.Id = rep.Id; map.Title = rep.Title; if (map.Title == null) { map.Title = ""; } maps.Add(map); } request.ReportPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), reportPath)); request.LayoutReport = maps; return(ExecuteRequest(request)); }
public virtual LayoutMap InsertLayoutMap(LayoutMap entity) { LayoutMap other = new LayoutMap(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into LayoutMap ( [LayoutMapGUID] ,[LayoutID] ,[PageTypeID] ,[PageID] ,[CreatedOn] ) Values ( @LayoutMapGUID , @LayoutID , @PageTypeID , @PageID , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@LayoutMapID", entity.LayoutMapId) , new SqlParameter("@LayoutMapGUID", entity.LayoutMapGuid) , new SqlParameter("@LayoutID", entity.LayoutId) , new SqlParameter("@PageTypeID", entity.PageTypeId) , new SqlParameter("@PageID", entity.PageId) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) { throw new DataException("Identity column was null as a result of the insert operation."); } return(GetLayoutMap(Convert.ToInt32(identity))); } return(entity); }
/// <summary> /// Zooms the specified map element out by 10% /// </summary> public void ZoomOutMap(LayoutMap lm) { lm.ZoomOutMap(); }
public virtual LayoutMap DeleteLayoutMap(LayoutMap entity) { this.DeleteLayoutMap(entity.LayoutMapId); return(entity); }
public static void LayoutPageSize(Map pMap, LayoutControl pLayout, string pMapTitle, string pPageSizeName = "A3", double pWidth = 42, double pHeight = 29.7) { var mG = pLayout.CreateGraphics(); // Calculate position parameters int pPageWidth = Utilities.Cm(pWidth); int pPageHeight = Utilities.Cm(pHeight); //int pPageWidth = pLayout.PrinterSettings.DefaultPageSettings.PaperSize.Width; //int pPageHeight = pLayout.PrinterSettings.DefaultPageSettings.PaperSize.Height; int pOuterMargin = Utilities.Cm(1); int pInternalMargin = Utilities.Cm(0.25); int pTitleHeight = Utilities.Cm(1); int pSubTitleHeight = Utilities.Cm(0.5); int pTitleAreaHeight = pTitleHeight + pInternalMargin + pSubTitleHeight + pInternalMargin; int pLegendWidth = Utilities.Cm(5); int pMapRectWidth = ((pPageWidth - (2 * pOuterMargin)) - pLegendWidth) - pInternalMargin; int pMapRectHeight = (pPageHeight - (2 * pOuterMargin)) - pTitleAreaHeight; int pMapWidth = pMapRectWidth - (pInternalMargin * 2); int pMapHeight = pMapRectHeight - (pInternalMargin * 2); int pScaleBarHeight = Utilities.Cm(0.75); int pScaleBarWidth = Utilities.Cm(5); int pNArrowWidth = Utilities.Cm(1); int pNArrowHeight = Utilities.Cm(1); // Set fonts var mFont1 = new Font("Arial", 9, FontStyle.Bold, GraphicsUnit.Millimeter); var mFont2 = new Font("Arial", 4, FontStyle.Italic, GraphicsUnit.Millimeter); var mFont3 = new Font("Arial", 3, FontStyle.Regular, GraphicsUnit.Millimeter); // Set page size var mPaperSize = new PaperSize(); mPaperSize.PaperName = pPageSizeName; mPaperSize.Width = pPageWidth; mPaperSize.Height = pPageHeight; pLayout.PrinterSettings.DefaultPageSettings.PaperSize = mPaperSize; // Set printer margin to 1 cm pLayout.PrinterSettings.DefaultPageSettings.Margins = new Margins(pOuterMargin, pOuterMargin, pOuterMargin, pOuterMargin); // Add map to layout var mMap = new LayoutMap(pMap); //mMap.MapControl = pMap; mMap.Size = new Size(pPageWidth, pPageHeight); mMap.Location = new Point(0, 0); pLayout.AddToLayout(mMap); // Add map mask // Add top margin AddRectangle(pLayout, pPageWidth, pOuterMargin + pTitleAreaHeight, 0, 0); // Add right margin AddRectangle(pLayout, pOuterMargin + pInternalMargin + pLegendWidth, pPageHeight, ((pPageWidth - pOuterMargin) - pLegendWidth) - pInternalMargin, 0); // Add bottom margin AddRectangle(pLayout, pPageWidth, pOuterMargin, 0, pPageHeight - pOuterMargin); // Add left margin AddRectangle(pLayout, pOuterMargin, pPageHeight, 0, 0); // Add title element to layout var mMapTitleElement = new LayoutText(); mMapTitleElement.Name = "Title"; mMapTitleElement.Size = new Size(pMapRectWidth, pTitleHeight); mMapTitleElement.Location = new Point(pOuterMargin, pOuterMargin); mMapTitleElement.Text = pMapTitle; mMapTitleElement.Font = mFont1; pLayout.AddToLayout(mMapTitleElement); // Add subtitle element to layout var mSubTitleElement = new LayoutText(); mSubTitleElement.Name = "Subtitle"; mSubTitleElement.Size = new Size(pMapRectWidth, pSubTitleHeight); mSubTitleElement.Location = new Point(pOuterMargin, pOuterMargin + pTitleHeight + pInternalMargin); mSubTitleElement.Text = "New Addressing System for Abu Dhabi Municipality"; mSubTitleElement.Font = mFont2; pLayout.AddToLayout(mSubTitleElement); // Add map border rectangle to map var mRect = new LayoutRectangle(); mRect.Size = new Size(pMapRectWidth, pMapRectHeight); mRect.Location = new Point(pOuterMargin, pOuterMargin + pTitleAreaHeight); pLayout.AddToLayout(mRect); // Add legend element to layout var mLegend = new LayoutLegend(); mLegend.Name = "Legend"; mLegend.LayoutControl = pLayout; mLegend.Map = mMap; mLegend.Size = new Size(pLegendWidth, pMapRectHeight); mLegend.Location = new Point(pPageWidth - pOuterMargin - pLegendWidth, pOuterMargin + pTitleAreaHeight); mLegend.Font = mFont3; pLayout.AddToLayout(mLegend); // Add scalebar element to layout var mScaleBar = new LayoutScaleBar(); mScaleBar.Name = "Scale Bar"; mScaleBar.Map = mMap; mScaleBar.Unit = ScaleBarUnit.Meters; mScaleBar.UnitText = "m"; mScaleBar.Size = new Size(pScaleBarWidth, pScaleBarWidth); mScaleBar.Location = new Point(pOuterMargin + pInternalMargin + pInternalMargin, ((((pPageHeight - pOuterMargin) - pInternalMargin) - pInternalMargin) - pInternalMargin) - pScaleBarHeight); mScaleBar.Font = mFont3; mScaleBar.BreakBeforeZero = false; mScaleBar.NumberOfBreaks = 2; pLayout.AddToLayout(mScaleBar); // Add north arrow to layout var mNorthArrow = new LayoutNorthArrow(); mNorthArrow.Name = "North Arrow"; mNorthArrow.NorthArrowStyle = NorthArrowStyle.ArrowN; mNorthArrow.Size = new Size(Utilities.Cm(0.5), Utilities.Cm(1)); mNorthArrow.Location = new Point(Utilities.Cm(1.5), Utilities.Cm(3.5)); pLayout.AddToLayout(mNorthArrow); mG.DrawLine(new Pen(Color.Black), new Point(0, 0), new Point(500, 500)); }
public LayoutMap InsertLayoutMap(LayoutMap entity) { return(_iLayoutMapRepository.InsertLayoutMap(entity)); }
public LayoutMap UpdateLayoutMap(LayoutMap entity) { return(_iLayoutMapRepository.UpdateLayoutMap(entity)); }
/// <summary> /// 释放资源 /// </summary> public override void Dispose() { Draw.Dispose(); LayoutMap.Dispose(); }
/// <summary> /// Pans the map the specified amount /// </summary> /// <param name="lm">the layout map to pan</param> /// <param name="x">The distance to pan the map on x-axis in screen coord</param> /// <param name="y">The distance to pan the map on y-axis in screen coord</param> protected void PanMap(LayoutMap lm, float x, float y) { var mapOnScreen = PaperToScreen(lm.Rectangle); lm.PanMap((lm.Envelope.Width / mapOnScreen.Width) * x, (lm.Envelope.Height / mapOnScreen.Height) * -y); }
/// <summary> /// Overrides the OnPreRender method /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { SetupMenu(); if (AppLogic.AppConfigBool("Layouts.Enabled")) { bool HasMappedLayout = false; bool IsTopic = (Page as SkinBase).IsTopicPage; bool IsEntity = (Page as SkinBase).IsEntityPage; bool IsProduct = (Page as SkinBase).IsProductPage; int PageID = (Page as SkinBase).PageID; LayoutMap lm = new LayoutMap(); if (IsEntity) { String EntityType = (Page as SkinBase).EntityType; lm = new LayoutMap(EntityType, PageID); if (lm.LayoutID > 0) { HasMappedLayout = true; (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID); } } else if (IsTopic) { lm = new LayoutMap("topic", PageID); } else if (IsProduct) { lm = new LayoutMap("product", PageID); } else { String pName = CommonLogic.GetThisPageName(false); lm = new LayoutMap(pName, PageID); } if (lm.LayoutID > 0) { HasMappedLayout = true; (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID); } if (HasMappedLayout) { LayoutData ThisLayout = (Page as SkinBase).ThisLayout; if ((Page as SkinBase).ThisLayout != null) { bool exists = CommonLogic.FileExists(ThisLayout.LayoutFile); if (!exists) { exists = ThisLayout.CreateLayoutControl(); } if (exists) { Control ctrl = LoadControl("~/layouts/" + ThisLayout.LayoutID.ToString() + "/" + ThisLayout.Name + "_" + ThisLayout.Version.ToString() + ".ascx"); ContentPlaceHolder phContent = (ContentPlaceHolder)this.FindControl("PageContent"); phContent.Controls.Clear(); phContent.Controls.Add(ctrl); } } } } base.OnPreRender(e); }