コード例 #1
0
		/// <summary>
		/// Shows the dialog to the user.
		/// </summary>
		/// <param name="image">Specifies the image to export.</param>
		/// <param name="imageType">Specifies image types (i.e. color, grayscale, monochrome).</param>
		/// <param name="resolution">Specifies the resolution for the image.</param>
		/// <param name="fileFormat">Specifies file formats (i.e. BMP, JPEG, etc).</param>
		/// <param name="path">Specifies destination directory.</param>
		/// <param name="filename">Specifies the string that is used in the filename pattern.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="image"/> is <see langword="null"/>.
		/// </exception>
		/// <exception cref="T:System.ArgumentException">
		/// <para>
		///		Width or height of the <paramref name="resolution"/> structure are not positive.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="path"/> is <see langword="null"/> or an empty string.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="filename"/> is <see langword="null"/> or an empty string.
		/// </para>
		/// </exception>
		public void ShowDialog(
			Image image,
			NuGenImageType imageType,
			NuGenImageFileFormat fileFormat,
			Size resolution,
			string path,
			string filename
			)
		{
			if (image == null)
			{
				throw new ArgumentNullException("image");
			}

			this.SetProgressBarParams(_progressBar, imageType, fileFormat);

			NuGenImageExport export = new NuGenImageExport();
			export.Progress += this.exportProgress;

			ExportDelegate exportDelegate = new ExportDelegate(export.Export);
			exportDelegate.BeginInvoke(
				image,
				imageType,
				fileFormat,
				resolution,
				path,
				filename,
				new AsyncCallback(
					delegate
					{
						if (this.IsHandleCreated)
						{
							this.BeginInvoke(new MethodInvoker(
								delegate
								{
									this.Close();
								})
							);
						}
					}
				),
				null
			);

			base.ShowDialog();
		}
コード例 #2
0
		internal void AddExporter(Type type, ExportDelegate exporter)
		{
			Exporters[type] = exporter;
		}
コード例 #3
0
        public void Startup(ref object initializationData)
        {
            _application = initializationData as IApplication;
            if (_application == null) return;

            ArcMapAppHelperClass.GetValidWorkspaces(out _validWorkspaces);
            ArcMapAppHelperClass.GetTypeMaps(out _sqlPredicates, out _typeMapSystemToSql, out _typeMapSQLToSystem);
            _hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();

            SetupDocumentEvents(_application.Document);

            if (PipeManager == null)
            {
                _pipeName = String.Format("{0}.{1}", ArcMapApp.PipeBaseName, _application.hWnd);
                PipeManager = new PipeManager();
                PipeManager.Initialize(_pipeName, _pipeMaxReadBytes);
                PipeManager.IncomingDataReady += new EventHandler(_pipeManager_IncomingDataReady);

                _dummyControl = new System.Windows.Forms.Control();
                _dummyControl.CreateControl();

                _pipeSelDel = new PipeSelectionDelegate(PipeSelection);
                _selectedRowsUniqueDel = new SelectedRowsUniqueDelegate(SelectedRowsUnique);
                _flashSelFeatDel = new FlashSelectedFeatureDelegate(FlashFeature);
                _splitFeatDel = new SplitFeatureDelegate(SplitFeature);
                _splitFeatLogDel = new SplitFeaturesLogicallyDelegate(SplitFeaturesLogically);
                _mergeFeatDel = new MergeFeaturesDelegate(MergeFeatures);
                _mergeFeatLogDel = new MergeFeaturesLogicallyDelegate(MergeFeaturesLogically);
                _updAttsDel = new UpdateAttributesDelegate(UpdateAttributes);
                _updAttsSelDel = new UpdateAttributesSelectionDelegate(UpdateAttributes);
                _updAttsBulkDel = new UpdateAttributesBulkDelegate(UpdateAttributes);
                _selByQDefDel = new SelectByQueryDefDelegate(SelectByQueryDef);
                _selByQFilterDel = new SelectByQueryFilterDelegate(SelectByQueryFilter);
                _selByJoinDel = new SelectByJoinDelegate(SelectByJoin);
                _zoomSelDel = new ZoomSelectedDelegate(ZoomSelected);
                _zoomSelCursorDel = new ZoomSelectedCursorDelegate(ZoomSelectedCursor);
                _exportDel = new ExportDelegate(Export);
                _isHluWorkspaceDel = new IsHluWorkspaceDelegate(IsHluWorkspace);
                _ListHluLayersDel = new ListHluLayersDelegate(ListHluLayers);
                _isHluLayerDel = new IsHluLayerDelegate(IsHluLayer);
                _isEditingDel = new IsEditingDelegate(IsEditing);
            }
        }
コード例 #4
0
        public void Shutdown()
        {
            _hluLayer = null;
            _hluFeatureClass = null;
            _hluFeatureSelection = null;
            _hluWS = null;
            _hluSqlSyntax = null;
            _hluView = null;
            _hluFieldMap = null;
            _hluFieldNames = null;
            _hluUidFieldOrdinals = null;
            _selectFieldOrdinals = null;

            _pipeSelDel = null;
            _selectedRowsUniqueDel = null;
            _flashSelFeatDel = null;
            _splitFeatDel = null;
            _splitFeatLogDel = null;
            _mergeFeatDel = null;
            _mergeFeatLogDel = null;
            _updAttsDel = null;
            _updAttsSelDel = null;
            _updAttsBulkDel = null;
            _selByQDefDel = null;
            _selByQFilterDel = null;
            _selByJoinDel = null;
            _zoomSelDel = null;
            _zoomSelCursorDel = null;
            _exportDel = null;
            _isHluWorkspaceDel = null;
            _ListHluLayersDel = null;
            _isHluLayerDel = null;
            _isEditingDel = null;

            if (PipeManager != null)
            {
                PipeManager = null;
            }

            RemoveActiveViewEvents(_focusMap);
        }
コード例 #5
0
 internal void AddExporter(Type type, ExportDelegate exporter)
 {
     Exporters[type] = exporter;
 }
コード例 #6
0
        private void mnuBothManageUnManage_Click(object sender, EventArgs e)
        {
            List<DataModel.Solution> lstExportSolution = GetSolutionToExport();
            DataModel.ExportSettings settings = GetSettings();
            
            settings.IsManaged = false;
            this.ccsb.SetMessage("Exporting unmanaged solutions... please wait...");
            ExportDelegate export = new ExportDelegate(Export);
            IAsyncResult result = export.BeginInvoke(lstExportSolution, settings, null, null);
            export.EndInvoke(result);

            this.ccsb.SetMessage("Exporting manage solutions... please wait...");
            ExportDelegate export1 = new ExportDelegate(Export);
            settings.IsManaged = true;
            IAsyncResult result1 = export1.BeginInvoke(lstExportSolution, settings, AsyncCallBack, null);
            
        }
コード例 #7
0
ファイル: AbstractFileParser.cs プロジェクト: vogelb/ambeth
        protected bool DoExport(FileInfo sourceFile, DirectoryInfo targetDir, int index, ExportDelegate exportDelegate)
        {
            FileInfo targetFile = BuildTargetFileName(sourceFile, targetDir, index);

            fileInfoUpdateDelegates.Add(delegate()
            {
                UpdateFileInfo(targetFile, sourceFile);
            });
            if (!targetFile.Exists)
            {
                exportDelegate(targetFile);
                Log.Info("\tCreated '" + targetFile + "'");
                return(true);
            }
            FileInfo tempTargetFile = BuildTargetFileName(sourceFile, targetDir, index);

            exportDelegate(tempTargetFile);

            if (AreFilesEqual(tempTargetFile, targetFile))
            {
                Log.Info("\tSkipped '" + targetFile + "' (still current)");
                return(false);
            }
            targetFile.Delete();
            tempTargetFile.MoveTo(targetFile.FullName);
            Log.Info("\tUpdated '" + targetFile + "'");
            return(true);
        }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: GAIPS-INESC-ID/DIMA
        private void Export(string filePath, Simulation sim)
        {
            CultureInfo ci = new CultureInfo("pt-PT", false);

            // Export to CVS
            var csv = new StringBuilder();

            csv.AppendFormat(ci, "sep=\t;\n");
            csv.AppendFormat(ci, "alfa\t{0}\n", sim.comparativeFitAlfa);
            csv.AppendFormat(ci, "beta\t{0}\n", sim.comparativeFitBeta);
            csv.AppendFormat(ci, "distance constraint\t{0}\n", sim.distanceConstraint);
            csv.AppendFormat(ci, "normative match distance\t{0}\n", sim.normativeMatchDistance);

            csv.AppendFormat(ci, "total agents\t{0}\n", sim.agents.Count);

            /*
             * csv.Append("theme characteristics\t");
             *
             * foreach (var characteristic in simulationContext.relevantCharacteristcs)
             *  csv.AppendFormat(ci, "{0}\t", characteristic.name);
             *
             * csv.AppendLine();
             * csv.AppendLine();
             */


            foreach (var characteristic in simulationContext.relevantCharacteristcs)
            {
                csv.AppendFormat(ci, "characteristic '{0}'\t", characteristic.name);
                csv.AppendFormat(ci, "{0}\t", characteristic.weight);

                csv.AppendLine();
            }

            csv.AppendLine();

            csv.Append("\t");
            foreach (var agent in sim.agents)
            {
                csv.AppendFormat(ci, "{0}\t", agent.name);
            }

            csv.AppendLine();

            foreach (var characteristic in simulationContext.relevantCharacteristcs)
            {
                csv.AppendFormat(ci, "characteristic '{0}'\t", characteristic.name);
                foreach (var agent in sim.agents)
                {
                    csv.AppendFormat(ci, "{0}\t", agent.characteristics[characteristic]);
                }

                csv.AppendLine();
            }

            csv.AppendLine();

            /*
             * csv.Append("total characteristics\t");
             * foreach (var agent in simulation.agents)
             *  csv.AppendFormat(ci, "{0}\t", agent.characteristics.Count);
             *
             * csv.AppendLine();
             *
             * csv.Append("group\t");
             * foreach (var agent in simulation.agents)
             *  csv.AppendFormat(ci, "{0}\t", agent.GetSelfCluster());
             *
             * csv.AppendLine();
             */

            ExportDelegate varExport = (name, dataExport) =>
            {
                csv.Append(name + "\t");
                csv.AppendLine();

                foreach (var agent in sim.agents)
                {
                    csv.AppendFormat(ci, "{0}\t", agent.name);

                    foreach (var data in agent.exportData)
                    {
                        if (data.group == null)
                        {
                            csv.AppendFormat(ci, "N/A\t");
                        }
                        else
                        {
                            csv.AppendFormat(ci, "{0}\t", dataExport(data));
                        }
                    }

                    csv.AppendLine();
                }

                csv.AppendLine();
            };

            varExport("matched group name", dataExport => dataExport.group.name);
            varExport("agent-group distance", dataExport => dataExport.agentDistance.ToString());
            varExport("group dispersion", dataExport => dataExport.dispersion.ToString());
            varExport("group distance", dataExport => dataExport.groupDistance.ToString());
            varExport("comparative fit", dataExport => dataExport.comparativeFit.ToString());
            varExport("accessibility", dataExport => dataExport.accessibility.ToString());
            varExport("salience", dataExport => dataExport.salience.ToString());
            varExport("wealth", dataExport => dataExport.wealth.ToString());
            varExport("offers", dataExport => dataExport.donations.ToString());
            varExport("donations", dataExport => dataExport.donations.ToString());

            KbExportDelegate kbExport = (agent, name, dataExport) =>
            {
                csv.Append(name + "\t");
                csv.AppendLine();

                List <List <string> > orderedValues = new List <List <string> >();

                Int32 numDataValues = 0;
                foreach (var data in agent.exportData)
                {
                    Int32 numKb = data.kbData.Count;

                    for (Int32 i = 0; i < numKb; i++)
                    {
                        if (orderedValues.Count <= i)
                        {
                            orderedValues.Add(new List <string>());

                            for (Int32 ii = 0; ii < numDataValues; ii++)
                            {
                                orderedValues[i].Add("N/A");
                            }
                        }

                        orderedValues[i].Add(dataExport(data.kbData[i]));
                    }

                    for (Int32 i = numKb; i < orderedValues.Count; i++)
                    {
                        orderedValues[i].Add("N/A");
                    }

                    numDataValues++;
                }

                Int32 numValues = orderedValues.Count;

                for (Int32 i = 0; i < numValues; i++)
                {
                    if (i < agent.knowledgeBase.Count)
                    {
                        csv.Append(agent.knowledgeBase[i].name + "\t");
                    }
                    else
                    {
                        csv.Append("Unfamiliar_Group" + "\t");
                    }

                    foreach (var value in orderedValues[i])
                    {
                        csv.Append(value + "\t");
                    }

                    csv.AppendLine();
                }

                csv.AppendLine();
            };

            foreach (var agent in sim.agents)
            {
                csv.Append(agent.name + "\t");
                csv.AppendLine();

                kbExport(agent, "salience", dataExport => dataExport.salience.ToString());
                kbExport(agent, "accessibility", dataExport => dataExport.accessibility.ToString());

                csv.AppendLine();
            }

            csv.AppendLine();
            try
            {
                File.WriteAllText(filePath, csv.ToString());
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error");
            }
        }