/// <summary>
        ///     The select.
        /// </summary>
        /// <param name="exportType">
        ///     The export.
        /// </param>
        /// <returns>
        ///     The <see cref="IEnumerable{T}" />.
        /// </returns>
        public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
        {
            foreach (MethodInfo methodInfo in exportType.ImplementType.GetMethods(AopConstants.DefaultBindingFlags))
            {
                var attr = methodInfo.GetCustomAttribute<InjectAttribute>();
                if (attr == null) continue;

                var meta = attr.CreateMetadata();

                if (methodInfo.GetParameters().Length == 1)
                {
                    yield return
                        new ImportMetadata(
                            attr.Interface,
                            attr.ContractName,
                            exportType,
                            methodInfo.Name,
                            attr.Optional,
                            meta);
                }
                else
                {
                    meta.Add(AopConstants.ParameterMetadataName, Helper.MapParameters(methodInfo).ToArray());

                    yield return
                        new ImportMetadata(
                            null,
                            null,
                            exportType,
                            methodInfo.Name,
                            false,
                            meta);
                }
            }
        }
        /// <summary>
        ///     The select import.
        /// </summary>
        /// <param name="exportType">
        ///     The export type.
        /// </param>
        /// <returns>
        ///     The <see cref="IEnumerable" />.
        /// </returns>
        public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
        {
            Contract.Requires<ArgumentNullException>(exportType != null, "exportType");
            Contract.Ensures(Contract.Result<IEnumerable<ImportMetadata>>() != null);

            return null;
        }
        /// <summary>
        ///     The select.
        /// </summary>
        /// <param name="exportType">
        ///     The export.
        /// </param>
        /// <returns>
        ///     The <see cref="IEnumerable{T}" />.
        /// </returns>
        public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
        {
            var metadatas = new HashSet<ImportMetadata>();
            foreach (ImportMetadata importMetadata in
                _selectors.SelectMany(selector => selector.SelectImport(exportType))) metadatas.Add(importMetadata);

            return metadatas;
        }
 /// <summary>
 ///     The select.
 /// </summary>
 /// <param name="exportType">
 ///     The export.
 /// </param>
 /// <returns>
 ///     The <see cref="IEnumerable{T}" />.
 /// </returns>
 public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
 {
     return from fieldInfo in exportType.ImplementType.GetFields(AopConstants.DefaultBindingFlags)
            let attr = fieldInfo.GetCustomAttribute<InjectAttribute>()
            where attr != null
            select
                new ImportMetadata(
                attr.Interface,
                attr.ContractName,
                exportType,
                fieldInfo.Name,
                attr.Optional,
                attr.CreateMetadata());
 }
        public DefaultBuildContext(IExport targetExport, BuildMode mode, IContainer container, string contractName, 
            ErrorTracer errorTracer, BuildParameter[] parameters, IResolverExtension[] resolverExtensions)
        {
            Contract.Requires<ArgumentNullException>(targetExport != null, "targetExport");
            Contract.Requires<ArgumentNullException>(container != null, "container");
            Contract.Requires<ArgumentNullException>(errorTracer != null, "errorTracer");

            Metadata = targetExport.GetNamedExportMetadata(contractName);
            errorTracer.Export = Metadata.ToString();
            ExportType = targetExport.ImplementType;
            Target = null;
            BuildCompled = false;
            Policys = new PolicyList();
            Mode = mode;
            Container = container;
            ErrorTracer = errorTracer;
            Parameters = parameters;
            ResolverExtensions = resolverExtensions;
        }
Ejemplo n.º 6
0
        public void When_ResistorModel_Expect_Reference()
        {
            // Bug found by Marcin Golebiowski
            ResistorModel model;
            Resistor      res;
            var           ckt = new Circuit(
                new CurrentSource("I1", "0", "a", 1),
                model = new ResistorModel("RM1"),
                res   = new Resistor("R1", "a", "0", "RM1"));

            model.Parameters.DefaultWidth    = 0.5e-6;
            model.Parameters.Narrow          = 0.1e-6;
            model.Parameters.SheetResistance = 20;
            res.Parameters.Length            = 5e-6;

            var op = new OP("op");

            var exports    = new IExport <double>[] { new RealVoltageExport(op, "a") };
            var references = new[] { 245.0 };

            AnalyzeOp(op, ckt, exports, references);
            DestroyExports(exports);
        }
        /// <summary>
        ///     The select.
        /// </summary>
        /// <param name="exportType">
        ///     The export.
        /// </param>
        /// <returns>
        ///     The <see cref="IEnumerable{T}" />.
        /// </returns>
        public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
        {
            foreach (EventInfo eventInfo in exportType.ImplementType.GetEvents(AopConstants.DefaultBindingFlags))
            {
                var attr = eventInfo.GetCustomAttribute<InjectEventAttribute>();
                if (attr != null)
                {
                    yield return
                        new ImportMetadata(
                            eventInfo.EventHandlerType,
                            attr.Topic,
                            exportType,
                            eventInfo.Name,
                            true,
                            null);
                }
            }

            foreach (MethodInfo methodInfo in exportType.ImplementType.GetMethods(AopConstants.DefaultBindingFlags))
            {
                var attr = methodInfo.GetCustomAttribute<InjectEventAttribute>();
                if (attr == null) continue;

                yield return
                    new ImportMetadata(
                        methodInfo.GetType(),
                        attr.Topic,
                        exportType,
                        methodInfo.Name,
                        true,
                        new Dictionary<string, object>
                        {
                            {AopConstants.EventMetodMetadataName, true},
                            {AopConstants.EventTopicMetadataName, attr.Topic}
                        });
            }
        }
Ejemplo n.º 8
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            lblStatus.Text = "Загрузка настроек. Ожидайте";

            Export = new ExportExcel();
            this.AppSettingsReader = new Models.AppSettingsReader();
            AppSettings            = await AppSettingsReader.ExecuteAsync();

            cbServers.DataSource    = AppSettings.ServersDataSource;
            cbServers.DisplayMember = "Name";
            cbServers.ValueMember   = "SysName";
            cbServers.Enabled       = true;


            //cbServers.Invoke(new Action(() =>
            //{
            //    cbServers.DataSource = serversDataSource;
            //    cbServers.DisplayMember = "Name";
            //    cbServers.ValueMember = "SysName";
            //    cbServers.Enabled = true;
            //}));

            lblStatus.Text = "Настройки загружены";
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 根据导出文件的路径export实例对象
        /// </summary>
        /// <returns></returns>
        private IExport getExportClass(string path)
        {
            if (path == "无")
            {
                MessageBox.Show("请选择输出路径!");
                return(null);
            }
            //根据给定的文件扩展名,来决定生成不同类型的对象
            IExport export = null;

            if (path.EndsWith(".jpg"))
            {
                export = new ExportJPEGClass();
            }
            else if (path.EndsWith(".tiff"))
            {
                export = new ExportTIFFClass();
            }
            else if (path.EndsWith(".bmp"))
            {
                export = new ExportBMPClass();
            }
            else if (path.EndsWith(".emf"))
            {
                export = new ExportEMFClass();
            }
            else if (path.EndsWith(".png"))
            {
                export = new ExportPNGClass();
            }
            else if (path.EndsWith(".gif"))
            {
                export = new ExportGIFClass();
            }
            return(export);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 输出图片
        /// </summary>
        /// <param name="activeView"></param>
        /// <param name="outPath">图片输出的完整路径,路径扩展名应为jpg,tiff,bmp,emf,png,gif,pdf,eps,ai,svg之一</param>
        /// <param name="resolution">图片分辨率(每英寸点数)</param>
        /// <returns></returns>
        public static bool ExportToPicture(this IActiveView activeView, string outPath, double resolution = 300)
        {
            IExport export     = CreateExport(outPath, resolution);
            tagRECT exportRECT = activeView.ExportFrame;

            export.PixelBounds = new EnvelopeClass
            {
                XMin = exportRECT.left,
                YMin = exportRECT.top,
                XMax = exportRECT.right,
                YMax = exportRECT.bottom
            };

            //activeView.Output(int hDC, int dpi, ref tagRECT pixelBounds, ref IEnvelope visibleBounds, ref ITrackCancel trackCancel);
            //hDC - 输出设备
            //dpi - 每英寸点数(分辨率)。如果为0,则默认为hDC的分辨率。如果无法采样,则默认为窗口分辨率
            //pixelBounds - 以像素为单位指定的设备矩形
            //VisibleBounds - 缩放范围。如果传递Null,则默认为当前可见范围
            //如果要将数据框绘制到640x480位图,请指定以下参数值:
            //  dpi - 0
            //  pixelBounds - { 0, 0, 640, 480 }
            //  visible bounds -0
            //如果要创建在300 DPI打印机上打印8.5 x 11的位图,请指定以下参数值:
            //  dpi - 300
            //  pixel bounds - { 0, 0, 8.5 * dpi, 11 * dpi }
            //  visible bounds -0
            //如果要缩放到某个位置并在300x300位图上绘制,请指定以下参数值:
            //  dpi - 0
            //  pixel bounds - { 0, 0, 300, 300 }
            //  visible bounds -  { -45.0, 44.0, -44.0, 45.0 }
            activeView.Output(export.StartExporting(), (int)export.Resolution, ref exportRECT, null, null);

            export.FinishExporting();
            export.Cleanup();
            return(true);
        }
        public HttpResponseMessage Download()
        {
            IList <ReferencesSchool> list = Service.GetAll();
            IList <RefsFileDto>      dtos = RefsFileDto.ToDtos(list);

            ErrMsg             msg = new ErrMsg();
            ExcelConfiguration cfg = new ExcelConfiguration();

            cfg.TemplatePath     = ConfigurationManager.AppSettings["refsDataPath"];
            cfg.TemplateRowIndex = 1;
            IExport export = ExcelFactory.Instance().GetExcelExporter(cfg, msg);

            byte[]              data = export.Export <RefsFileDto>(dtos);
            MemoryStream        ms   = new MemoryStream(data);
            HttpResponseMessage res  = new HttpResponseMessage(HttpStatusCode.OK);

            res.Content = new StreamContent(ms);
            res.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
            res.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = "refs_file.xlsx"
            };
            return(res);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 测试初始化
 /// </summary>
 public ExportPerformanceTest()
 {
     _export = ExportFactory.CreateExcel2007Export();
     _list   = OfficeTest.CreateList2();
 }
Ejemplo n.º 13
0
 /// <summary>
 /// This function provides a safe way to async-execute any exporter to write to a file directly.
 /// </summary>
 /// <param name="exp">The exporter to be used.</param>
 /// <param name="tt">A readonly copy of the current timetable.</param>
 /// <param name="filename"></param>
 /// <param name="pluginInterface">A reduced PluginInterface that provides limited core features from FPledit.</param>
 /// <param name="flags">Exporter flags.</param>
 /// <returns>A Task that has not been started yet, which can be used to execute the exporter.</returns>
 public static Task <bool> GetAsyncSafeExport(this IExport exp, Timetable tt, string filename, IReducedPluginInterface pluginInterface, string[]?flags = null)
 => new Task <bool>(() => exp.SafeExport(tt, filename, pluginInterface, flags));
 public SimpleBuildPrameter([NotNull] object obj)
 {
     _export = DefaultExportFactory.Factory.CreateAnonymosWithTarget(obj.GetType(), obj);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// エクスポート実行
 /// </summary>
 /// <param name="export"></param>
 public void Export(IExport export)
 {
     _WorkAreaManager.ActiveContent?.Export(export);
 }
        /// <summary>
        ///     The build up.
        /// </summary>
        /// <param name="export">
        ///     The export.
        /// </param>
        /// <param name="contractName">
        ///     The contract name.
        /// </param>
        /// <param name="tracer"></param>
        /// <param name="buildParameters"></param>
        /// <returns>
        ///     The <see cref="object" />.
        /// </returns>
        public object BuildUp(IExport export, string contractName, ErrorTracer tracer, BuildParameter[] buildParameters)
        {
            Contract.Requires<ArgumentNullException>(export != null, "export");

            lock (export)
            {
                try
                {
                    tracer.Phase = "Begin Building Up";
                    var context = new DefaultBuildContext(export, BuildMode.Resolve, container, contractName,
                        tracer, buildParameters, _componentRegistry.GetAll<IResolverExtension>().ToArray());
                    var buildObject = new BuildObject(export.ImportMetadata, context.Metadata, buildParameters);
                    Pipeline.Build(context);
                    if (tracer.Exceptional) return null;
                    buildObject.Instance = context.Target;
                    if (!export.ExternalInfo.External && !export.ExternalInfo.HandlesLiftime)
                        RebuildManager.AddBuild(buildObject);

                    Contract.Assume(context.Target != null);
                    return context.Target;
                }
                catch (Exception e)
                {
                    tracer.Exceptional = true;
                    tracer.Exception = e;
                    return null;
                }
            }
        }
 public ValidationErrorSeed(IExport export)
 {
     _export = export;
 }
Ejemplo n.º 18
0
        public static ManageUsersViewModel LoadManageUsersViewModel(IUserServices iUserServices, IExport iexport)
        {
            ManageUsersViewModel manageUsersViewModel = new ManageUsersViewModel(iUserServices, iexport);

            manageUsersViewModel.LoadUsers();
            return(manageUsersViewModel);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// エクスポート実行
 /// </summary>
 /// <param name="export"></param>
 public bool Export(IExport export) => export.Export(_Model);
Ejemplo n.º 20
0
 /// <summary>
 /// Предоставляет класс для работы с СУБД MySql.
 /// </summary>
 /// <param name="connection">Строка подключения к СУБД</param>
 public MySqlDB(string connection)
 {
     this.connection = connection;
     this.Export     = new MySqlExport(this);
     this.Entities   = new MySqlGetter(this);
 }
 //Constructor: assigns strategy to interface
 public ExportContext(IExport strategy)
 {
     this.exportInterface = strategy;
 }
        //使用IActiveView.Output方法输出
        //Width和Hight用于设置输出的图片尺寸,默认为0则使用ActiveView.ExportFrame
        //VisibleBounds用于设置待输出的地图范围,默认为null则使用ActiveView.Extent
        private void ActiveViewOutput(IActiveView docActiveView, int iOutputResolution, int Width, int Height, IEnvelope VisibleBounds, string sExportFileName, IExport docExport)
        {
            docExport.ExportFileName = sExportFileName;
            if (iOutputResolution <= 0) iOutputResolution = 96;
            if (Width <= 0 || Height <= 0)
            {
            Width = docActiveView.ExportFrame.right;
            Height = docActiveView.ExportFrame.bottom;
            if (Width == 0)
                Width = 1024;
            if (Height == 0)
                Height = 768;
            Width = (Width * iOutputResolution) / 96;
            Height = (Height * iOutputResolution) / 96;
            }
            docExport.Resolution = iOutputResolution;
            ESRI.ArcGIS.esriSystem.tagRECT exportRECT = new ESRI.ArcGIS.esriSystem.tagRECT();
            exportRECT.left = 0;
            exportRECT.top = 0;
            exportRECT.right = Width;
            exportRECT.bottom = Height;

            IEnvelope envelope = new EnvelopeClass();
            envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
            docExport.PixelBounds = envelope;

            System.Int32 hDC = docExport.StartExporting();
            docActiveView.Output(hDC, iOutputResolution, ref exportRECT, VisibleBounds, null);
            docExport.FinishExporting();
            docExport.Cleanup();
        }
 public SimpleBuildPrameter([CanBeNull] IExport export)
 {
     _export = export;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Exports the map extent.
        /// </summary>
        /// <param name="activeView">The active view.</param>
        /// <param name="outRect">The out rect.</param>
        /// <param name="sOutputPath">The output file path.</param>
        /// <param name="dResolution">The d resolution.</param>
        /// <returns><c>true</c> if succeed, <c>false</c> otherwise.</returns>
        public bool ExportMapExtent(IActiveView activeView, Size outRect, string sOutputPath, double dResolution)
        {
            bool result;

            try
            {
                if (activeView == null)
                {
                    result = false;
                }
                else
                {
                    IExport export = null;
                    if (sOutputPath.EndsWith(".jpg"))

                    {
                        export = new ExportJPEGClass();
                    }
                    else if (sOutputPath.EndsWith(".tif"))

                    {
                        export = new ExportTIFFClass();
                    }
                    else if (sOutputPath.EndsWith(".bmp"))

                    {
                        export = new ExportBMPClass();
                    }
                    else if (sOutputPath.EndsWith(".emf"))

                    {
                        export = new ExportEMFClass();
                    }
                    else if (sOutputPath.EndsWith(".png"))

                    {
                        export = new ExportPNGClass();
                    }
                    else if (sOutputPath.EndsWith(".gif"))

                    {
                        export = new ExportGIFClass();
                    }
                    export.ExportFileName = sOutputPath;
                    IEnvelope extent = activeView.Extent;
                    export.Resolution = dResolution;
                    tagRECT tagRECT = default(tagRECT);
                    tagRECT.left   = (tagRECT.top = 0);
                    tagRECT.right  = outRect.Width;
                    tagRECT.bottom = (int)((double)tagRECT.right * extent.Height / extent.Width);
                    IEnvelope envelope = new EnvelopeClass();
                    envelope.PutCoords((double)tagRECT.left, (double)tagRECT.top, (double)tagRECT.right, (double)tagRECT.bottom);
                    export.PixelBounds = envelope;
                    ITrackCancel trackCancel = new CancelTrackerClass();
                    export.TrackCancel = trackCancel;
                    trackCancel.Reset();
                    trackCancel.CancelOnKeyPress = true;
                    trackCancel.CancelOnClick    = false;
                    trackCancel.ProcessMessages  = true;
                    int hDC = export.StartExporting();
                    activeView.Output(hDC, (int)((short)export.Resolution), ref tagRECT, extent, trackCancel);
                    bool flag = trackCancel.Continue();
                    if (flag)
                    {
                        export.FinishExporting();
                        export.Cleanup();
                    }
                    else
                    {
                        export.Cleanup();
                    }
                    flag   = trackCancel.Continue();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                result = false;
            }
            return(result);
        }
 /// <summary>
 ///     The select import.
 /// </summary>
 /// <param name="exportType">
 ///     The export type.
 /// </param>
 /// <returns>
 ///     The <see cref="IEnumerable" />.
 /// </returns>
 /// <exception cref="NotImplementedException">
 /// </exception>
 public IEnumerable<ImportMetadata> SelectImport(IExport exportType)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 ///     The register.
 /// </summary>
 /// <param name="exportType">
 ///     The export.
 /// </param>
 /// <param name="level"></param>
 public void Register(IExport exportType, int level)
 {
     _exports.Register(exportType, level);
 }
        /// <summary>
        ///     The register.
        /// </summary>
        /// <param name="exportType">
        ///     The export type.
        /// </param>
        /// <param name="level"></param>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public void Register(IExport exportType, int level)
        {
            Contract.Requires<ArgumentNullException>(exportType != null, "exportType");

            throw new NotImplementedException();
        }
Ejemplo n.º 28
0
        //导出
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (tbxSavePath.Text.Trim() == "" || !tbxSavePath.Text.Trim().Contains("\\"))
            {
                MessageBox.Show("请选择正确的输出路径!", "提示");
                return;
            }
            IExport pExport = null;

            try
            {
                switch (pSimpleFiletype)
                {
                case "tif":
                    pExport = new ExportTIFF() as IExport;
                    break;

                case "EMF":
                    pExport = new ExportEMF() as IExport;
                    break;

                case "eps":
                    pExport = new ExportPS() as IExport;
                    break;

                case "ai":
                    pExport = new ExportAI() as IExport;
                    break;

                case "pdf":
                    pExport = new ExportPDF() as IExport;
                    break;

                case "svg":
                    pExport = new ExportSVG() as IExport;
                    break;

                case "bmp":
                    pExport = new ExportBMP() as IExport;
                    break;

                case "jpg":
                    pExport = new ExportEMF() as IExport;
                    break;

                case "png":
                    pExport = new ExportPNG() as IExport;
                    break;

                case "gif":
                    pExport = new ExportGIF() as IExport;
                    break;

                default:
                    return;
                }
                pExport.ExportFileName = pSavePath;
                pExport.Resolution     = pResolution;
                tagRECT pTagRECT;
                pTagRECT = pActiveView.ExportFrame;
                IPrintAndExport printAndExport = new PrintAndExport();
                printAndExport.Export(pActiveView, pExport, pResolution, false, null);
                Marshal.ReleaseComObject(pExport);
                MessageBox.Show("导出成功!", "提示");
            }
            catch (COMException ex)
            {
                MessageBox.Show("导出失败\n" + ex.Message, "错误");
                return;
            }
        }
Ejemplo n.º 29
0
 public EsfExport(IExport export, ILogger logger)
     : base(new ValidMdbContext(), export, logger, Constants.TaskExportEsfTables, 6)
 {
 }
Ejemplo n.º 30
0
        /// <summary>
        /// 写入当前切片级别地理坐标系切片
        /// </summary>
        /// <param name="i"></param>
        /// <param name="tileFileInfo"></param>
        /// <param name="outPutDir"></param>
        public static void WriteGeoLevel(int i, TileFileInfo tileFileInfo, string outPutDir)
        {
            IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
            IWorkspace        pWs           = workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(tileFileInfo.filePath), 0);
            IFeatureClass     pFeatureClass = (pWs as IFeatureWorkspace).OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(tileFileInfo.filePath));
            IFeatureLayer     featureLayer  = new FeatureLayerClass
            {
                FeatureClass = pFeatureClass
            };
            IDataset dataSet = (IDataset)pFeatureClass;

            featureLayer.Name = dataSet.Name;
            IMap map = new MapClass();

            map.AddLayer(featureLayer);

            IMapControlDefault pMapControl = new MapControlClass();

            pMapControl.Map = map;
            IActiveView pActiveView = pMapControl.ActiveView;

            tagRECT rect = new tagRECT();

            rect.left   = rect.top = 0;
            rect.right  = 256;
            rect.bottom = 256;
            IExport pExport = null;

            IEnvelope pEnvelope = new EnvelopeClass();
            string    temp      = i.ToString();

            if (temp.Length < 2)
            {
                temp = "0" + temp;
            }
            System.IO.DirectoryInfo LevelDir = new System.IO.DirectoryInfo(outPutDir).CreateSubdirectory($"L{temp}");
            pMapControl.MapScale = TileParam.TileParamProjCoordinateSystem.TileScales[i];
            pMapControl.Refresh();
            Console.WriteLine($"Level:L{temp}:分辨率{TileParam.TileParamGeoCoordinateSystem.TileResolutions[i]}");
            double imageHeighy = TileParam.TileParamGeoCoordinateSystem.TileResolutions[i] * TileParam.TileParamGeoCoordinateSystem.TileSize;

            for (int dy = 1, iRnum = 0; TileParam.TileOriginGeo.OriginY - imageHeighy * dy > tileFileInfo.MinY - imageHeighy; dy++, iRnum++)
            {
                if (TileParam.TileOriginGeo.OriginY - imageHeighy * dy > tileFileInfo.MaxY)
                {
                    continue;
                }
                string tmpy = iRnum.ToString("X");
                while (tmpy.Length < 8)
                {
                    tmpy = "0" + tmpy;
                }
                Console.WriteLine($"--行号:R{tmpy}");
                System.IO.DirectoryInfo RowDir = LevelDir.CreateSubdirectory($"R{tmpy}");

                for (int dx = 1, iCnum = 0; TileParam.TileOriginGeo.OriginX + imageHeighy * dx < tileFileInfo.MaxX + imageHeighy; dx++, iCnum++)
                {
                    if (TileParam.TileOriginGeo.OriginX + imageHeighy * dx < tileFileInfo.MinX)
                    {
                        continue;
                    }
                    string tmpx = iCnum.ToString("X");
                    while (tmpx.Length < 8)
                    {
                        tmpx = "0" + tmpx;
                    }
                    try
                    {
                        pEnvelope.PutCoords(TileParam.TileOriginGeo.OriginX + imageHeighy * (dx - 1), TileParam.TileOriginGeo.OriginY - imageHeighy * dy, TileParam.TileOriginGeo.OriginX + imageHeighy * dx, TileParam.TileOriginGeo.OriginY - imageHeighy * (dy - 1));
                        pExport = ToExporter("PNG");
                        pExport.ExportFileName = RowDir.FullName + "\\C" + tmpx + ".png";
                        Console.WriteLine($"----列号:C{tmpx}    {pExport.ExportFileName}");
                        pExport.Resolution = 96;
                        IEnvelope pPixelBoundsEnv = new EnvelopeClass();
                        pPixelBoundsEnv.PutCoords(rect.left, rect.top, rect.right, rect.bottom);
                        pExport.PixelBounds = pPixelBoundsEnv;
                        //开始导出,获取DC
                        int hDC = pExport.StartExporting();
                        //导出
                        pActiveView.Output(hDC, 96, ref rect, pEnvelope, null);
                        //结束导出
                        pExport.FinishExporting();
                        //清理导出类
                        pExport.Cleanup();
                        RealeaseAO(pExport);
                        RealeaseAO(pPixelBoundsEnv);
                    }
                    catch (Exception ex) { Helpers.ErrorHelper.PrintException(ex); }
                }
            }
            RealeaseAO(workspaceFactory);
            RealeaseAO(pWs);
            RealeaseAO(pFeatureClass);
            RealeaseAO(featureLayer);
            RealeaseAO(map);
            RealeaseAO(pMapControl);
        }
        private static bool IsViewModelForType([CanBeNull] this IExport <object> item, [CanBeNull] Type viewModel, [CanBeNull] object role)
        {
            var metadata = new DataTemplateMetadata(item?.Metadata);

            return((metadata.DataType == viewModel) && RoleEquals(metadata.Role, role));
        }
Ejemplo n.º 32
0
 public FCAAlgoritm(IExport export)
 {
     _export = export;
     Context = export.ToMatrix();
 }
Ejemplo n.º 33
0
        public void When_BreakpointsTransient_Expect_Reference()
        {
            // Build the circuit
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", new Pulse(0, 5, 1e-7, 1e-7, 1e-7, 1e-5, 2e-5)),
                new VoltageDelay("Delay1", "out", "0", "in", "0", 0.5e-5)
                // This will make the delay element add a breakpoint when the input changes rapidly
                .SetParameter("reltol", 0.5)
                );

            // Build the simulation
            var tran    = new Transient("tran", 1e-7, 10e-5);
            var exports = new IExport <double>[]
            {
                new GenericExport <double>(tran, () => tran.GetState <IIntegrationMethod>().Time),
                new RealVoltageExport(tran, "in"),
                new RealVoltageExport(tran, "out"),
            };
            var references = new[]
            {
                new[]
                {
                    0, 1E-09, 2E-09, 4E-09, 8E-09, 1.6E-08, 3.2E-08, 6.4E-08, 1E-07, 1.064E-07, 1.192E-07, 1.448E-07,
                    1.96E-07, 2E-07, 2.08E-07, 2.24E-07, 2.55999999999999E-07, 3.19999999999999E-07,
                    4.47999999999997E-07, 7.03999999999994E-07, 1.21599999999999E-06, 2.23999999999998E-06,
                    4.23999999999998E-06, 5.1E-06, 5.11E-06, 5.13E-06, 5.17E-06, 5.2E-06, 5.208E-06, 5.224E-06,
                    5.256E-06, 5.32E-06, 5.448E-06, 5.704E-06, 6.216E-06, 7.24E-06, 9.24E-06, 1.02E-05, 1.021E-05,
                    1.023E-05, 1.027E-05, 1.03E-05, 1.0308E-05, 1.0324E-05, 1.0356E-05, 1.042E-05, 1.0548E-05,
                    1.0804E-05, 1.1316E-05, 1.234E-05, 1.434E-05, 1.52E-05, 1.521E-05, 1.523E-05, 1.527E-05, 1.53E-05,
                    1.5308E-05, 1.5324E-05, 1.5356E-05, 1.542E-05, 1.5548E-05, 1.5804E-05, 1.6316E-05,
                    1.73400000000001E-05, 1.93400000000001E-05, 2.01E-05, 2.011E-05, 2.013E-05, 2.017E-05, 2.02E-05,
                    2.0208E-05, 2.0224E-05, 2.0256E-05, 2.032E-05, 2.0448E-05, 2.0704E-05, 2.1216E-05, 2.224E-05,
                    2.424E-05, 2.51E-05, 2.511E-05, 2.513E-05, 2.517E-05, 2.52E-05, 2.5208E-05, 2.5224E-05, 2.5256E-05,
                    2.532E-05, 2.5448E-05, 2.5704E-05, 2.6216E-05, 2.724E-05, 2.924E-05, 3.02E-05, 3.021E-05, 3.023E-05,
                    3.027E-05, 3.03E-05, 3.0308E-05, 3.0324E-05, 3.0356E-05, 3.042E-05, 3.0548E-05, 3.0804E-05,
                    3.1316E-05, 3.234E-05, 3.434E-05, 3.52E-05, 3.521E-05, 3.523E-05, 3.527E-05, 3.53E-05, 3.5308E-05,
                    3.5324E-05, 3.5356E-05, 3.542E-05, 3.5548E-05, 3.5804E-05, 3.6316E-05, 3.73400000000001E-05,
                    3.93400000000001E-05, 4.01E-05, 4.011E-05, 4.013E-05, 4.017E-05, 4.02E-05, 4.0208E-05, 4.0224E-05,
                    4.0256E-05, 4.032E-05, 4.0448E-05, 4.0704E-05, 4.1216E-05, 4.22400000000001E-05,
                    4.42400000000001E-05, 4.51E-05, 4.511E-05, 4.513E-05, 4.517E-05, 4.52E-05, 4.5208E-05, 4.5224E-05,
                    4.5256E-05, 4.532E-05, 4.5448E-05, 4.5704E-05, 4.6216E-05, 4.724E-05, 4.92400000000001E-05,
                    5.02E-05, 5.021E-05, 5.023E-05, 5.027E-05, 5.03E-05, 5.0308E-05, 5.0324E-05, 5.0356E-05, 5.042E-05,
                    5.0548E-05, 5.0804E-05, 5.1316E-05, 5.23400000000001E-05, 5.43400000000001E-05, 5.52E-05, 5.521E-05,
                    5.523E-05, 5.527E-05, 5.53E-05, 5.5308E-05, 5.5324E-05, 5.5356E-05, 5.542E-05, 5.5548E-05,
                    5.5804E-05, 5.6316E-05, 5.73400000000001E-05, 5.93400000000001E-05, 6.01E-05, 6.011E-05, 6.013E-05,
                    6.017E-05, 6.02E-05, 6.0208E-05, 6.0224E-05, 6.0256E-05, 6.032E-05, 6.0448E-05, 6.0704E-05,
                    6.1216E-05, 6.22400000000001E-05, 6.42400000000001E-05, 6.51E-05, 6.511E-05, 6.513E-05, 6.517E-05,
                    6.52E-05, 6.5208E-05, 6.5224E-05, 6.5256E-05, 6.532E-05, 6.5448E-05, 6.5704E-05, 6.6216E-05,
                    6.72400000000001E-05, 6.92400000000001E-05, 7.02E-05, 7.021E-05, 7.023E-05, 7.027E-05, 7.03E-05,
                    7.0308E-05, 7.0324E-05, 7.0356E-05, 7.042E-05, 7.0548E-05, 7.0804E-05, 7.1316E-05,
                    7.23400000000001E-05, 7.43400000000001E-05, 7.52E-05, 7.521E-05, 7.523E-05, 7.527E-05, 7.53E-05,
                    7.5308E-05, 7.5324E-05, 7.5356E-05, 7.542E-05, 7.5548E-05, 7.5804E-05, 7.6316E-05,
                    7.73400000000001E-05, 7.93400000000001E-05, 8.01E-05, 8.011E-05, 8.013E-05, 8.017E-05, 8.02E-05,
                    8.0208E-05, 8.0224E-05, 8.0256E-05, 8.032E-05, 8.0448E-05, 8.0704E-05, 8.1216E-05,
                    8.22400000000001E-05, 8.42400000000001E-05, 8.51E-05, 8.511E-05, 8.513E-05, 8.517E-05, 8.52E-05,
                    8.5208E-05, 8.5224E-05, 8.5256E-05, 8.532E-05, 8.5448E-05, 8.5704E-05, 8.6216E-05,
                    8.72400000000001E-05, 8.92400000000001E-05, 9.02E-05, 9.021E-05, 9.023E-05, 9.027E-05, 9.03E-05,
                    9.0308E-05, 9.0324E-05, 9.0356E-05, 9.042E-05, 9.0548E-05, 9.0804E-05, 9.1316E-05,
                    9.23400000000001E-05, 9.43400000000001E-05, 9.52E-05, 9.521E-05, 9.523E-05, 9.527E-05, 9.53E-05,
                    9.5308E-05, 9.5324E-05, 9.5356E-05, 9.542E-05, 9.5548E-05, 9.5804E-05, 9.6316E-05,
                    9.73400000000001E-05, 9.93400000000001E-05, 0.0001
                },
                new[]
                {
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.32, 0.960000000000001, 2.24, 4.8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000009, 3.5000000000001, 1.50000000000012,
                    4.79616346638068E-14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0.50000000000008, 1.50000000000007, 3.50000000000005, 4.99999999999995, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999993, 1.49999999999995,
                    4.79616346638068E-14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0.499999999999741, 1.4999999999999, 3.49999999999988, 4.99999999999978, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999976, 1.49999999999978,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.50000000000008,
                    1.50000000000024, 3.50000000000022, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 4.50000000000026, 3.5000000000001, 1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.499999999999741, 1.4999999999999, 3.50000000000022, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000026,
                    3.5000000000001, 1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0
                },
                new[]
                {
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.49999999999999,
                    1.49999999999998, 3.49999999999996, 4.99999999999999, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000018, 3.50000000000018, 1.50000000000003,
                    4.79616346637966E-14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0.50000000000008, 1.50000000000007, 3.50000000000005, 4.99999999999995, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999976, 1.49999999999978,
                    4.79616346637864E-14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0.499999999999741, 1.4999999999999, 3.49999999999988, 4.99999999999978, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999976, 1.49999999999978,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.499999999999741,
                    1.4999999999999, 3.50000000000022, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 4.50000000000026, 3.5000000000001, 1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.499999999999741, 1.4999999999999, 3.50000000000022, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000026, 3.5000000000001,
                    1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                },
            };

            // Analyze
            AnalyzeTransient(tran, ckt, exports, references);
            DestroyExports(exports);
        }
        /// <summary>
        ///     The equals.
        /// </summary>
        /// <param name="other">
        ///     The other.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool Equals(IExport other)
        {
            if (ReferenceEquals(null, other)) return false;

            if (ReferenceEquals(this, other)) return true;

            return ImplementType == other.ImplementType;
        }
Ejemplo n.º 35
0
 public ExportController(IExport export)
 {
     this.export = export;
 }
Ejemplo n.º 36
0
        public void When_SimplePulsedTransient_Expect_Reference()
        {
            // Build the circuit
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", new Pulse(0, 5, 1e-7, 1e-7, 1e-7, 1e-5, 2e-5)),
                new VoltageDelay("Delay1", "out", "0", "in", "0", 0.5e-5)
                );

            // Build the simulation
            var tran    = new Transient("tran", 1e-7, 10e-5);
            var exports = new IExport <double>[]
            {
                new GenericExport <double>(tran, () => tran.GetState <IIntegrationMethod>().Time),
                new RealVoltageExport(tran, "in"),
                new RealVoltageExport(tran, "out"),
            };
            var references = new[]
            {
                new[]
                {
                    0, 1E-09, 2E-09, 4E-09, 8E-09, 1.6E-08, 3.2E-08, 6.4E-08, 1E-07, 1.064E-07, 1.192E-07, 1.448E-07,
                    1.96E-07, 2E-07, 2.08E-07, 2.24E-07, 2.55999999999999E-07, 3.19999999999999E-07,
                    4.47999999999997E-07, 7.03999999999994E-07, 1.21599999999999E-06, 2.23999999999998E-06,
                    4.23999999999998E-06, 6.23999999999998E-06, 8.23999999999998E-06, 1.02E-05, 1.021E-05, 1.023E-05,
                    1.027E-05, 1.03E-05, 1.0308E-05, 1.0324E-05, 1.0356E-05, 1.042E-05, 1.0548E-05, 1.0804E-05,
                    1.1316E-05, 1.234E-05, 1.434E-05, 1.634E-05, 1.834E-05, 2.01E-05, 2.011E-05, 2.013E-05, 2.017E-05,
                    2.02E-05, 2.0208E-05, 2.0224E-05, 2.0256E-05, 2.032E-05, 2.0448E-05, 2.0704E-05, 2.1216E-05,
                    2.224E-05, 2.424E-05, 2.624E-05, 2.824E-05, 3.02E-05, 3.021E-05, 3.023E-05, 3.027E-05, 3.03E-05,
                    3.0308E-05, 3.0324E-05, 3.0356E-05, 3.042E-05, 3.0548E-05, 3.0804E-05, 3.1316E-05, 3.234E-05,
                    3.434E-05, 3.634E-05, 3.834E-05, 4.01E-05, 4.011E-05, 4.013E-05, 4.017E-05, 4.02E-05, 4.0208E-05,
                    4.0224E-05, 4.0256E-05, 4.032E-05, 4.0448E-05, 4.0704E-05, 4.1216E-05, 4.22400000000001E-05,
                    4.42400000000001E-05, 4.62400000000001E-05, 4.82400000000001E-05, 5.02E-05, 5.021E-05, 5.023E-05,
                    5.027E-05, 5.03E-05, 5.0308E-05, 5.0324E-05, 5.0356E-05, 5.042E-05, 5.0548E-05, 5.0804E-05,
                    5.1316E-05, 5.23400000000001E-05, 5.43400000000001E-05, 5.63400000000001E-05, 5.83400000000001E-05,
                    6.01E-05, 6.011E-05, 6.013E-05, 6.017E-05, 6.02E-05, 6.0208E-05, 6.0224E-05, 6.0256E-05, 6.032E-05,
                    6.0448E-05, 6.0704E-05, 6.1216E-05, 6.22400000000001E-05, 6.42400000000001E-05,
                    6.62400000000001E-05, 6.82400000000001E-05, 7.02E-05, 7.021E-05, 7.023E-05, 7.027E-05, 7.03E-05,
                    7.0308E-05, 7.0324E-05, 7.0356E-05, 7.042E-05, 7.0548E-05, 7.0804E-05, 7.1316E-05,
                    7.23400000000001E-05, 7.43400000000001E-05, 7.63400000000001E-05, 7.83400000000001E-05, 8.01E-05,
                    8.011E-05, 8.013E-05, 8.017E-05, 8.02E-05, 8.0208E-05, 8.0224E-05, 8.0256E-05, 8.032E-05,
                    8.0448E-05, 8.0704E-05, 8.1216E-05, 8.22400000000001E-05, 8.42400000000001E-05,
                    8.62400000000001E-05, 8.82400000000001E-05, 9.02E-05, 9.021E-05, 9.023E-05, 9.027E-05, 9.03E-05,
                    9.0308E-05, 9.0324E-05, 9.0356E-05, 9.042E-05, 9.0548E-05, 9.0804E-05, 9.1316E-05,
                    9.23400000000001E-05, 9.43400000000001E-05, 9.63400000000001E-05, 9.83400000000001E-05, 0.0001
                },
                new[]
                {
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.32, 0.960000000000001, 2.24, 4.8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 4.50000000000009, 3.5000000000001, 1.50000000000012, 4.79616346638068E-14, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0.50000000000008, 1.50000000000007, 3.50000000000005, 4.99999999999995, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999993, 1.49999999999995, 4.79616346638068E-14,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.499999999999741, 1.4999999999999, 3.49999999999988,
                    4.99999999999978, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.49999999999992, 3.49999999999976,
                    1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.50000000000008, 1.50000000000024,
                    3.50000000000022, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000026, 3.5000000000001,
                    1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.499999999999741, 1.4999999999999,
                    3.50000000000022, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4.50000000000026, 3.5000000000001,
                    1.49999999999978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                },
                new[]
                {
                    0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 0, 0, 0
                },
            };

            // Analyze
            AnalyzeTransient(tran, ckt, exports, references);
            DestroyExports(exports);
        }