コード例 #1
0
        public string GetRealThemeName(IArea area, string theme)
        {
            if (string.IsNullOrEmpty(theme))
                theme = "default";

            string dir = Path.Combine(ServerUtil.MapPath(area.VirtualPath), "themes");

            string format = theme;
            if (format.IndexOf('.') != -1)
                format = format.Split('.')[0];

            if (IsMobile)
            {
                if (Directory.Exists(Path.Combine(dir, string.Format("{0}_mobile", theme))))
                    return string.Format("{0}_mobile", theme);

                if (format != theme && Directory.Exists(Path.Combine(dir, string.Format("{0}_mobile", format))))
                    return string.Format("{0}_mobile", format);

                if (format != "default" && Directory.Exists(Path.Combine(dir, "default_mobile")))
                    return "default_mobile";

                return "default";
            }
            else
            {
                if (Directory.Exists(Path.Combine(dir, theme)))
                    return theme;

                if (format != theme && Directory.Exists(Path.Combine(dir, format)))
                    return format;

                return "default";
            }
        }
コード例 #2
0
ファイル: DesktopBitmap.cs プロジェクト: tzachshabtay/MonoAGS
		public IBitmap ApplyArea(IArea area)
		{
			//todo: performance can be improved by only creating a bitmap the size of the area, and not the entire background.
			//This will require to change the rendering as well to offset the location
			byte zero = (byte)0;
			Bitmap output = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
			using (FastBitmap inBmp = new FastBitmap (_bitmap, ImageLockMode.ReadOnly))
			{
				using (FastBitmap outBmp = new FastBitmap (output, ImageLockMode.WriteOnly, true))
				{
					for (int y = 0; y < Height; y++)
					{
						int bitmapY = Height - y - 1;
						for (int x = 0; x < Width; x++)
						{
							System.Drawing.Color color = inBmp.GetPixel(x, bitmapY);
							byte alpha = area.IsInArea(new AGS.API.PointF(x, y)) ? color.A : zero;
							outBmp.SetPixel(x, bitmapY, System.Drawing.Color.FromArgb(alpha, color));
						}
					}
				}
			}

            return new DesktopBitmap(output, _graphics);
		}
        public CoreDataSetProvider New(IArea area)
        {
            Area _area =  area as Area;

            if (_area == null)
            {
                CategoryArea categoryArea = area as CategoryArea;
                if (categoryArea.IsGpDeprivationDecile)
                {
                    return new GpDeprivationDecileCoreDataSetProvider(categoryArea, PracticeDataAccess);
                }
                return new CategoryAreaCoreDataSetProvider(categoryArea, GroupDataReader);
            }

            // Area 
            if (_area.IsCcg)
            {
                return new CcgCoreDataSetProvider(_area,
                    CcgPopulationProvider, CoreDataSetListProvider, GroupDataReader);
            }

            if (_area.IsShape)
            {
                return new ShapeCoreDataSetProvider(_area, PracticeDataAccess);
            }

            return new SimpleCoreDataSetProvider(_area, GroupDataReader);
        }
コード例 #4
0
ファイル: AreaStream.cs プロジェクト: prepare/deveeldb
        public AreaStream(IArea area)
        {
            if (area == null)
                throw new ArgumentNullException("area");

            this.area = area;
        }
コード例 #5
0
ファイル: AndroidBitmap.cs プロジェクト: tzachshabtay/MonoAGS
		public IBitmap ApplyArea(IArea area)
		{
			//todo: performance can be improved by only creating a bitmap the size of the area, and not the entire background.
			//This will require to change the rendering as well to offset the location
			byte zero = (byte)0;
			Bitmap output = Bitmap.CreateBitmap(Width, Height, Bitmap.Config.Argb8888);
			using (FastBitmap inBmp = new FastBitmap (_bitmap))
			{
				using (FastBitmap outBmp = new FastBitmap (output, true))
				{
					for (int y = 0; y < Height; y++)
					{
						int bitmapY = Height - y - 1;
						for (int x = 0; x < Width; x++)
						{
							global::Android.Graphics.Color color = inBmp.GetPixel(x, bitmapY);
							byte alpha = area.IsInArea(new AGS.API.PointF(x, y)) ? color.A : zero;
							outBmp.SetPixel(x, bitmapY, new global::Android.Graphics.Color(color.R, color.G, color.B, alpha));
						}
					}
				}
			}

            return new AndroidBitmap(output, _graphics);
		}
コード例 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abbreviation"></param>
 /// <param name="toBase"></param>
 /// <param name="fromBase"></param>
 /// <param name="surfaceArea"></param>
 /// <param name="squareRadius"></param>
 protected SolidAngleBase(string abbreviation,
     IUnitConversion toBase, IUnitConversion fromBase,
     IArea surfaceArea, ILength squareRadius)
     : base(abbreviation, toBase, fromBase, surfaceArea, squareRadius)
 {
     VerifyDimensions();
 }
コード例 #7
0
        public Dictionary<int, IndicatorStatsResponse> GetIndicatorStats()
        {
            profileIds = _parameters.RestrictResultsToProfileIdList;
            parentArea = AreaFactory.NewArea(areasReader, _parameters.ParentAreaCode);

            var roots = GetRoots();
            var responseObjects = new Dictionary<int, IndicatorStatsResponse>();

            SetAreaCodesToIgnore();

            if (parentArea.IsCcg)
            {
                ccgPopulation = new CcgPopulationProvider(pholioReader).GetPopulation(parentArea.Code);
            }

            childAreaCount = new ChildAreaCounter(areasReader)
                .GetChildAreasCount(parentArea, _parameters.ChildAreaTypeId);

            int rootIndex = 0;
            foreach (var root in roots)
            {
                Grouping grouping = root.Grouping[0];
                IndicatorMetadata metadata = indicatorMetadataRepository.GetIndicatorMetadata(grouping);
                TimePeriod timePeriod = new DataPointOffsetCalculator(grouping, _parameters.DataPointOffset, metadata.YearType).TimePeriod;

                IEnumerable<double> values = GetValuesForStats(grouping, timePeriod);

                IndicatorStatsResponse statsAndStatF;
                if (values != null)
                {
                    IndicatorStatsPercentiles statsPercentiles = new IndicatorStatsCalculator(values).GetStats();
                    var formatter = NumericFormatterFactory.New(metadata, groupDataReader);
                    indicatorStatsProcessor.Truncate(statsPercentiles);

                    statsAndStatF = new IndicatorStatsResponse
                    {
                        IID = metadata.IndicatorId,
                        Stats = statsPercentiles,
                        StatsF = formatter.FormatStats(statsPercentiles),
                        HaveRequiredValues = doEnoughAreasHaveValues
                    };
                }
                else
                {
                    // No stats calculated
                    statsAndStatF = new IndicatorStatsResponse
                    {
                        IID = metadata.IndicatorId,
                        HaveRequiredValues = doEnoughAreasHaveValues
                    };
                }
                responseObjects[rootIndex] = statsAndStatF;

                rootIndex++;
            }

            return responseObjects;
        }
コード例 #8
0
		public static void Create(IArea area, float minScaling, float maxScaling, bool scaleObjectsX = true, bool scaleObjectsY = true, bool scaleVolume = true)
		{
            var component = area.AddComponent<IScalingArea>();
            component.MinScaling = minScaling;
            component.MaxScaling = maxScaling;
            component.ScaleObjectsX = scaleObjectsX;
            component.ScaleObjectsY = scaleObjectsY;
            component.ScaleVolume = scaleVolume;
		}
コード例 #9
0
 private static void CheckOnlyOneCoreDataSetFound(Grouping grouping, IArea area,
     IList<CoreDataSet> dataList)
 {
     if (dataList.Count > 1)
     {
         throw new FingertipsException(string.Format("More than one CoreDataSet row for: IndicatorId={0} Area={1}",
             grouping.IndicatorId, area.Code));
     }
 }
コード例 #10
0
        public LogicalBinaryStateActuator RegisterLogicalActuator(IArea area, Enum id)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));

            var actuator = new LogicalBinaryStateActuator(ComponentIdGenerator.Generate(area.Id, id), _timerService);
            area.AddComponent(actuator);

            return actuator;
        }
コード例 #11
0
        public ILamp RegisterLamp(IArea area, Enum id, IBinaryOutput output)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (output == null) throw new ArgumentNullException(nameof(output));

            var lamp = new Lamp(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output));
            area.AddComponent(lamp);

            return lamp;
        }
コード例 #12
0
        public ISocket RegisterSocket(IArea area, Enum id, IBinaryOutput output)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (output == null) throw new ArgumentNullException(nameof(output));

            var socket = new Socket(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output));
            area.AddComponent(socket);

            return socket;
        }
コード例 #13
0
        public IHumiditySensor RegisterHumiditySensor(IArea area, Enum id, INumericValueSensorEndpoint endpoint)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));

            var humditySensor = new HumiditySensor(ComponentIdGenerator.Generate(area.Id, id), _settingsService, endpoint);
            area.AddComponent(humditySensor);

            return humditySensor;
        }
コード例 #14
0
        public IObject GetDrawable(IArea area, IBitmap bg)
		{
            IWalkBehindArea walkBehind = area.GetComponent<IWalkBehindArea>();
            if (walkBehind == null) return null;
			AreaKey key = new AreaKey (area, bg);
			IObject obj = _objects.GetOrAdd(key, () => createObject());
			obj.Z = walkBehind.Baseline == null ? area.Mask.MinY : walkBehind.Baseline.Value;
			obj.Image = _images.GetOrAdd(key, () => createImage(area, bg));
			return obj;
		}
コード例 #15
0
        public AreaInputStream(IArea area, int buffer_size)
        {
            if (buffer_size <= 0)
             				throw new ArgumentOutOfRangeException("buffer_size", "The buffer size cannot be smaller or equal to 0.");

             			this.area = area;
             			this.buffer = new byte[buffer_size];
             			this.count = 0;
             			this.pos = 0;
        }
コード例 #16
0
 protected IArea GetNationalArea(IArea area)
 {
     if (_nationalArea == null)
     {
         _nationalArea = area.IsCountry
             ? area
             : AreaFactory.NewArea(_areasReader, AreaCodes.England);
     }
     return _nationalArea;
 }
コード例 #17
0
        public IndicatorComparisonHelper(IndicatorMetadata indicatorMetadata, Grouping grouping,
            IGroupDataReader groupDataReader, PholioReader pholioReader, IArea nationalArea)
        {
            // Assign constructor parameter to instance variables
            this.indicatorMetadata = indicatorMetadata;
            this.grouping = grouping;
            this.groupDataReader = groupDataReader;

            InitComparer(pholioReader, nationalArea);
        }
コード例 #18
0
        /// <summary>
        /// 依赖的资源名称,多个资源名称使用逗号分隔
        /// </summary>
        /// <param name="resourceName"></param>
        public void Require(IArea area, string resourceName)
        {
            if (string.IsNullOrEmpty(resourceName)) return;

            JContext jc = JContext.Current;

            foreach (var res in StringUtil.Split(resourceName, StringUtil.Comma, true, true))
            {
                if (res == "jquery.js")
                {
                    Head.RequireJquery = true;
                    continue;
                }

                string resourceUrl = string.Empty;

                string key = string.Format("define_{0}", res);

                if (area != null && !string.IsNullOrEmpty(area[key]))
                {
                    resourceUrl = jc.CombinUrl(area, area[key], false);
                }
                else
                {
                    foreach (IArea item in jc.Host.AllAreas)
                    {
                        if (area != null && item.AreaKey == area.AreaKey) continue;

                        if (!string.IsNullOrEmpty(item[key]))
                        {
                            resourceUrl = jc.CombinUrl(item, item[key], false);
                            break;
                        }
                    }

                    if (string.IsNullOrEmpty(resourceUrl))
                    {
                        if (res == "kiss.js" || res == "kiss.css" || res == "jqueryui.js" || res == "jqueryui.css")
                        {
                            resourceUrl = Resources.Utility.GetResourceUrl(GetType(), "Kiss.Web.jQuery." + res, true);
                        }
                        else
                        {
                            throw new WebException("未找到{0}的定义。", res);
                        }
                    }
                }

                if (res.EndsWith(".js"))
                    RegisterJs(resourceUrl);
                else if (res.EndsWith(".css"))
                    RegisterCss(resourceUrl);
            }
        }
コード例 #19
0
        public Dictionary<int, NavigationItem> GetMenuItemsBySite(IArea site)
        {
            RefreshUrlMappingData();

            if (!_menuItems.ContainsKey(site.AreaKey))
            {
                logger.Info("menu not exist! area={0}", site.VirtualPath);
                return new Dictionary<int, NavigationItem>();
            }

            return _menuItems[site.AreaKey];
        }
コード例 #20
0
        /// <summary>
        ///     Supported combinations:
        ///     Parent area England & comparator (i) deprivation decile (ii) national
        ///     Parent area is a region & comparator (i) region
        /// </summary>
        public IList<CoreDataSet> Build(Grouping grouping)
        {
            InitBuild(grouping);

            if (Grouping != null)
            {
                parentArea = AreaFactory.NewArea(areasReader, ParentAreaCode);
                return GetDataList();
            }

            return null;
        }
コード例 #21
0
        public int GetChildAreasCount(IArea parentArea, int childAreaTypeId)
        {
            var categoryArea = parentArea as CategoryArea;
            if (categoryArea != null)
            {
                return _areasReader.GetChildAreaCount(categoryArea, childAreaTypeId);
            }

            return parentArea.IsCountry
                    ? _areasReader.GetAreaCountForAreaType(childAreaTypeId) // NOTE ignored areas not considered here
                    : _areasReader.GetChildAreaCount(parentArea.Code, childAreaTypeId);
        }
        public HealthProfilesKeyMessageDataBuilder(IArea area, CoreDataSetProvider coreDataSetProvider,
            CoreDataSetProvider benchmarkDataProvider, IndicatorMetadataCollection indicatorMetadataCollection,
            HealthProfilesGroupRootSelector groupRootSelector)
        {
            _area = area;
            keyMessageData.Area = area;
            this.coreDataSetProvider = coreDataSetProvider;
            this.benchmarkDataProvider = benchmarkDataProvider;
            this.groupRootSelector = groupRootSelector;
            this.indicatorMetadataCollection = indicatorMetadataCollection;

            _indicatorComparerFactory = new IndicatorComparerFactory {PholioReader = pholioReader};
        }
コード例 #23
0
 private void InitComparer(PholioReader pholioReader, IArea nationalArea)
 {
     if (indicatorMetadata.HasTarget)
     {
         targetComparer = TargetComparerFactory.New(indicatorMetadata.TargetConfig);
         new TargetComparerHelper(groupDataReader, nationalArea)
             .AssignExtraDataIfRequired(nationalArea, targetComparer, grouping, indicatorMetadata);
     }
     else
     {
         comparer = new IndicatorComparerFactory {PholioReader = pholioReader}.New(grouping);
     }
 }
コード例 #24
0
        public virtual IList<CoreDataSet> GetChildAreaData(Grouping grouping, IArea parentArea, TimePeriod period)
        {
            var categoryArea = parentArea as CategoryArea;
            if (categoryArea != null)
            {
                return groupDataReader.GetCoreDataListForChildrenOfCategoryArea(
                    grouping, period, categoryArea);
            }

            return parentArea.IsCountry
                ? groupDataReader.GetCoreDataForAllAreasOfType(grouping, period)
                : groupDataReader.GetCoreDataListForChildrenOfArea(grouping, period, parentArea.Code);
        }
        public ParentAreaWithChildAreas GetParentAreaWithChildAreas(IArea parentArea, 
            int childAreaTypeId, bool retrieveIgnoredAreas)
        {
            _areaListProvider.CreateChildAreaList(parentArea.Code, childAreaTypeId);

            if (retrieveIgnoredAreas == false)
            {
                _areaListProvider.RemoveAreasIgnoredEverywhere(ignoredAreasFilter);
            }
            _areaListProvider.SortByOrderOrName();

            return new ParentAreaWithChildAreas(parentArea,  _areaListProvider.Areas, childAreaTypeId);
        }
コード例 #26
0
        public ConditionalOnAutomation RegisterConditionalOnAutomation(IArea area, Enum id)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));

            var automation =
                new ConditionalOnAutomation(
                    AutomationIdGenerator.Generate(area, id),
                    _schedulerService,
                    _dateTimeService,
                    _daylightService);

            area.AddAutomation(automation);

            return automation;
        }
コード例 #27
0
        public IMotionDetector RegisterMotionDetector(IArea area, Enum id, IBinaryInput input)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (input == null) throw new ArgumentNullException(nameof(input));

            var motionDetector = new MotionDetector(
                ComponentIdGenerator.Generate(area.Id, id),
                new PortBasedMotionDetectorEndpoint(input),
                _schedulerService,
                _settingsService);

            area.AddComponent(motionDetector);

            return motionDetector;
        }
コード例 #28
0
        public IButton RegisterButton(IArea area, Enum id, IBinaryInput input, Action<IButton> initializer = null)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (input == null) throw new ArgumentNullException(nameof(input));

            var button = new Button(
                ComponentIdGenerator.Generate(area.Id, id),
                new PortBasedButtonEndpoint(input),
                _timerService,
                _settingsService);

            initializer?.Invoke(button);

            area.AddComponent(button);
            return button;
        }
コード例 #29
0
        public ProfileDataBuilder(ComparatorMap comparatorMap, Profile profile, List<int> restrictSearchProfileIds,
            IList<ParentArea> parentAreas, IAreaType subnationalAreaType)
        {
            this._comparatorMap = comparatorMap;
            this._profile = profile;
            this._restrictSearchProfileIds = restrictSearchProfileIds;
            this._parentAreas = parentAreas;

            _profileDataWriter = new ProfileDataWriter(profile);

            _profileDataWriter.AddOrganisationDetails(profile.Id);

            _nationalArea = comparatorMap.GetNationalComparator().Area;

            this._subnationalAreaType = subnationalAreaType;
        }
コード例 #30
0
        private CoreDataSet GetDataFromDatabase(Grouping grouping, TimePeriod timePeriod, IArea parentArea)
        {
            CoreDataSet benchmarkData;

            var categoryArea = parentArea as ICategoryArea;
            if (categoryArea != null)
            {
                benchmarkData = _groupDataReader.GetCoreDataForCategoryArea(grouping, timePeriod, categoryArea);
            }
            else
            {
                IList<CoreDataSet> data = _groupDataReader.GetCoreData(grouping, timePeriod, parentArea.Code);
                CheckOnlyOneCoreDataSetFound(grouping, parentArea, data);
                benchmarkData = data.FirstOrDefault();
            }
            return benchmarkData;
        }
コード例 #31
0
ファイル: PolygonsDifference.cs プロジェクト: Leopold-Z/Test
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button != (int)Keys.LButton)
            {
                return;
            }
            ILayer layer = m_engineEditor.TargetLayer;

            if (layer == null)
            {
                MessageBox.Show("请先启动编辑!!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            m_activeView = m_hookHelper.ActiveView;
            m_map        = m_hookHelper.FocusMap;
            if (m_map == null || m_activeView == null)
            {
                return;
            }

            IPoint pPoint = m_activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            ISelectionEnvironment pSelectionEnvironment = new SelectionEnvironmentClass();

            pSelectionEnvironment.PointSelectionMethod = esriSpatialRelEnum.esriSpatialRelWithin;
            m_map.SelectByShape(pPoint as IGeometry, pSelectionEnvironment, false);
            if (m_map.SelectionCount != 2)
            {
                MessageBox.Show("选择的多边形个数应该为2!!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }
            m_activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, m_activeView.Extent);

            bool         deleteInteriorPolygon = false;
            DialogResult pDialogResult         = MessageBox.Show("是否要删除内多边形?", "操作提示", MessageBoxButtons.YesNo);

            if (pDialogResult == DialogResult.Yes)
            {
                deleteInteriorPolygon = true;
            }

            IEnumFeature      pEnumFeature      = m_map.FeatureSelection as IEnumFeature;
            IEnumFeatureSetup pEnumFeatureSetup = pEnumFeature as IEnumFeatureSetup;

            pEnumFeatureSetup.AllFields = true;
            IFeature firstFeature  = pEnumFeature.Next();
            IFeature secondFeature = pEnumFeature.Next();

            IArea     pAreaFirst          = firstFeature.Shape as IArea;
            IArea     pAreaSecond         = secondFeature.Shape as IArea;
            IGeometry pGeometry           = null;
            bool      firstPolygonIsLarge = false;

            IRelationalOperator pRelationalOperator = firstFeature.Shape as IRelationalOperator;

            if (pAreaFirst.Area > pAreaSecond.Area)
            {
                if (pRelationalOperator.Contains(secondFeature.Shape))
                {
                    ITopologicalOperator pTopologicalOperator = firstFeature.Shape as ITopologicalOperator;
                    pGeometry           = pTopologicalOperator.Difference(secondFeature.Shape);
                    firstPolygonIsLarge = true;
                }
            }
            else
            {
                pRelationalOperator = secondFeature.Shape as IRelationalOperator;
                if (pRelationalOperator.Contains(firstFeature.Shape))
                {
                    ITopologicalOperator pTopologicalOperator = secondFeature.Shape as ITopologicalOperator;
                    pGeometry           = pTopologicalOperator.Difference(firstFeature.Shape);
                    firstPolygonIsLarge = false;
                }
            }
            IFeatureClass  featureClass  = firstFeature.Class as IFeatureClass;
            IDataset       dataset       = featureClass as IDataset;
            IWorkspaceEdit workspaceEdit = dataset.Workspace as IWorkspaceEdit;

            if (!(workspaceEdit.IsBeingEdited()))
            {
                return;
            }

            workspaceEdit.StartEditOperation();
            if (firstPolygonIsLarge)
            {
                firstFeature.Shape = pGeometry;
                firstFeature.Store();
                if (deleteInteriorPolygon)
                {
                    secondFeature.Delete();
                }
            }
            else
            {
                secondFeature.Shape = pGeometry;
                secondFeature.Store();
                if (deleteInteriorPolygon)
                {
                    firstFeature.Delete();
                }
            }
            workspaceEdit.StopEditOperation();
            m_map.ClearSelection();
            m_activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, m_activeView.Extent);
        }
コード例 #32
0
        private void SetupInitialStore()
        {
            byte[] tableInfoBuf;

            using (var stream = new MemoryStream()) {
                var writer = new BinaryWriter(stream, Encoding.Unicode);
                writer.Write(1);
                TableInfoSerializer.Serialize(TableInfo, writer);

                tableInfoBuf = stream.ToArray();
            }

            byte[] indexSetInfoBuf;

            using (var stream = new MemoryStream()) {
                var writer = new BinaryWriter(stream, Encoding.Unicode);
                writer.Write(1);

                IndexSetInfoSerializer.Serialize(IndexSetInfo, writer);

                indexSetInfoBuf = stream.ToArray();
            }

            try {
                Store.Lock();

                // Allocate an 80 byte header
                using (var headerWriter = Store.CreateArea(80)) {
                    long headerPointer = headerWriter.Id;

                    // Allocate space to store the DataTableInfo serialization
                    using (var dataTableDefWriter = Store.CreateArea(tableInfoBuf.Length)) {
                        long tableInfoOffset = dataTableDefWriter.Id;

                        // Allocate space to store the DataIndexSetInfo serialization
                        using (var indexSetWriter = Store.CreateArea(indexSetInfoBuf.Length)) {
                            long indexSetInfoPointer = indexSetWriter.Id;

                            // Allocate space for the list header
                            listHeaderOffset = recordList.Create();
                            recordList.WriteDeleteHead(-1);
                            firstDeleteChainRecord = -1;

                            // Create the index store
                            indexSetStore     = new IndexSetStore(Store);
                            indexHeaderOffset = indexSetStore.Create();

                            // Write the main header
                            headerWriter.Write((int)1);                              // Version
                            headerWriter.Write(TableId);                             // table id
                            headerWriter.Write(sequenceId);                          // initial sequence id
                            headerWriter.Write(tableInfoOffset);                     // pointer to DataTableInfo
                            headerWriter.Write(indexSetInfoPointer);                 // pointer to DataIndexSetInfo
                            headerWriter.Write(indexHeaderOffset);                   // index header pointer
                            headerWriter.Write(listHeaderOffset);                    // list header pointer
                            headerWriter.Flush();

                            // Write the table info
                            dataTableDefWriter.Write(tableInfoBuf, 0, tableInfoBuf.Length);
                            dataTableDefWriter.Flush();

                            // Write the index set info
                            indexSetWriter.Write(indexSetInfoBuf, 0, indexSetInfoBuf.Length);
                            indexSetWriter.Flush();

                            // Set the pointer to the header input the reserved area.
                            using (var fixedArea = Store.GetArea(-1)) {
                                fixedArea.Write(headerPointer);
                                fixedArea.Flush();
                            }

                            // Set the header area
                            headerArea = Store.GetArea(headerPointer);
                        }
                    }
                }
            } finally {
                Store.Unlock();
            }
        }
コード例 #33
0
ファイル: Guest.cs プロジェクト: marnixwieffering/HATL
        /// <summary>
        /// Checks in the guest
        /// </summary>
        private void _checkIn()
        {
            if (Path.Any())
            {
                _Move();
            }
            else if (Area is Reception)
            {
                if (((Reception)Area).EnterArea(this))
                {
                    if (Hotel.GetArea(RoomRequest) is null)
                    {
                        Status = MovableStatus.LEAVING;
                    }
                    else
                    {
                        IArea newRoom = Hotel.GetArea(RoomRequest);
                        SetPath(Hotel.GetArea(RoomRequest));
                        newRoom.AreaStatus = AreaStatus.OCCUPIED;
                        FinalDes           = newRoom;
                        MyRoom             = newRoom;


                        switch (((Room)MyRoom).Classification)
                        {
                        case 1:
                            MyRoom.Art = Properties.Resources.room_one_star_locked;
                            break;

                        case 2:
                            MyRoom.Art = Properties.Resources.room_two_star_locked;
                            break;

                        case 3:
                            MyRoom.Art = Properties.Resources.room_three_star_locked;
                            break;

                        case 4:
                            MyRoom.Art = Properties.Resources.room_four_star_locked;
                            break;

                        case 5:
                            MyRoom.Art = Properties.Resources.room_five_star_locked;
                            break;

                        default:
                            break;
                        }

                        ((Reception)Area).CheckInQueue.Dequeue();
                        Status = MovableStatus.GOING_TO_ROOM;
                    }
                }
                else if (!((Reception)Area).CheckInQueue.Contains(this))
                {
                    ((Reception)Area).CheckInQueue.Enqueue(this);
                }
                else
                {
                    // Kill timer
                }
            }
        }
コード例 #34
0
 public Window(TViewModel viewModel, IArea area)
     : this(viewModel, area.row, area.col, area.width, area.height, area.styleIndex, area.border, area.scrollbars)
 {
 }
コード例 #35
0
 public ExecuteArea(IArea aarea)
 {
     _area = aarea;
 }
コード例 #36
0
        public ApiReturn Get(double GrossWage, string AreaKey)
        {
            ApiReturn rtn = null;

            //Validate the input value of GrossWage
            if (GrossWage <= 0)
            {
                rtn = new ApiReturn()
                {
                    Code = ApiReturnCodes.GrossWageError
                    ,
                    Message = APIMessages.MESSAGE_GrossWage_Error_Invalid
                    ,
                    Data = GrossWage
                };
            }
            else
            {
                //Validate the input value of AreaKey
                if (string.IsNullOrEmpty(AreaKey))
                {
                    if (HttpContext.Session.IsAvailable)
                    {
                        AreaKey = HttpContext.Session.GetString(SESSION_LATEST_AREAKEY);
                    }
                }


                if (!string.IsNullOrEmpty(AreaKey))
                {
                    try
                    {
                        //Find / create area instance, and do calculation.
                        IArea area = AreaFactory.Instance.Create(AreaKey);

                        double deductedWage = area.Calculation.Cal(GrossWage);

                        Dictionary <string, object> values = new Dictionary <string, object>();
                        values["DeductedWage"] = deductedWage;
                        values["AreaKey"]      = AreaKey;
                        values["AreaName"]     = area.Name;
                        values["Time"]         = DateTime.Now;

                        rtn = new ApiReturn()
                        {
                            Code = ApiReturnCodes.Success
                            ,
                            Message = APIMessages.MESSAGE_SUCCESS
                            ,
                            Data = values
                        };

                        //Put AreaKey into session
                        HttpContext.Session.SetString(SESSION_LATEST_AREAKEY, AreaKey);
                    }
                    catch (AreaNotExistException notExistException)
                    {
                        rtn = new ApiReturn()
                        {
                            Code = ApiReturnCodes.AreaKeyNotExist
                            ,
                            Message = string.Format(APIMessages.MESSAGE_AreaKey_Error_NotExist, AreaKey)
                            ,
                            Data = AreaKey
                        };
                    }
                    catch (CalculationException calEx)
                    {
                        rtn = new ApiReturn()
                        {
                            Code = ApiReturnCodes.CalculationError
                            ,
                            Message = APIMessages.MESSAGE_Calculation_Error
                            ,
                            Data = AreaKey
                        };
                    }
                    catch (Exception ex)
                    {
                        rtn = new ApiReturn()
                        {
                            Code = ApiReturnCodes.OtherError
                            ,
                            Message = ex.Message
                            ,
                            Data = AreaKey
                        };
                    }
                }
                else
                {
                    rtn = new ApiReturn()
                    {
                        Code = ApiReturnCodes.AreaKeyNotExist
                        ,
                        Message = APIMessages.MESSAGE_AreaKey_Error_Empty
                        ,
                        Data = GrossWage
                    };
                }
            }


            return(rtn);
        }
コード例 #37
0
        private IFeature FeatureMess(ILayer pLayer, IActiveView pActView, IPoint pPoint)
        {
            ISpatialFilter pSpaFilter = new SpatialFilterClass();
            IEnvelope      pEnv       = new EnvelopeClass();

            pEnv = pPoint.Envelope;
            IFeatureLayer pFeatLayer = (IFeatureLayer)pLayer;
            IFeatureClass pFeatClass = pFeatLayer.FeatureClass;

            pSpaFilter.Geometry = pEnv;
            //为点建立缓冲区
            double realWorldDisExtend, sizeOfOnePixel;
            int    pixelExtend;

            pixelExtend        = pActView.ScreenDisplay.DisplayTransformation.get_DeviceFrame().right - pActView.ScreenDisplay.DisplayTransformation.get_DeviceFrame().left;
            realWorldDisExtend = pActView.ScreenDisplay.DisplayTransformation.VisibleBounds.Width;
            sizeOfOnePixel     = realWorldDisExtend / pixelExtend;
            double buffer = 2 * sizeOfOnePixel;

            pEnv.XMax = pPoint.X + buffer;
            pEnv.XMin = pPoint.X - buffer;
            pEnv.YMax = pPoint.Y + buffer;
            pEnv.YMin = pPoint.Y - buffer;

            switch (pFeatClass.ShapeType)
            {
            case esriGeometryType.esriGeometryPoint:
                pSpaFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
                break;

            case esriGeometryType.esriGeometryPolyline:
                pSpaFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelCrosses;
                break;

            case esriGeometryType.esriGeometryPolygon:
                pSpaFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                break;
            }
            IQueryFilter   pQueFilter  = (IQueryFilter)pSpaFilter;
            IFeatureCursor pFeatCursor = pFeatLayer.Search(pQueFilter, false);
            IFeature       pFeat       = pFeatCursor.NextFeature();

            if (pFeat != null)
            {
                IGeometry pGeo = pFeat.Shape;
                switch (pGeo.GeometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                    IPoint pFeatPnt = (IPoint)pGeo;

                    double px = CntUnit.ConvertUnits(pFeatPnt.X, inUnit.pUnit, outUnit.pUnit);
                    double py = CntUnit.ConvertUnits(pFeatPnt.Y, inUnit.pUnit, outUnit.pUnit);
                    m_SegLen.value = px;
                    m_SegLen.units = outUnit.pUnit;
                    m_TotLen.value = py;
                    m_TotLen.units = outUnit.pUnit;

                    px        = Math.Round(px, 6);
                    py        = Math.Round(py, 6);
                    shapeType = 1;

                    txtMessage.Text = "点要素" + "\r\nX:" + px + outUnit.UnitName + "\r\nY:" + py + outUnit.UnitName;
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    IPolyline pFeatLine  = (IPolyline)pGeo;
                    double    FeatLength = CntUnit.ConvertUnits(pFeatLine.Length, inUnit.pUnit, outUnit.pUnit);
                    m_TotLen.value = FeatLength;
                    m_TotLen.units = outUnit.pUnit;


                    FeatLength  = Math.Round(FeatLength, 6);
                    shapeType   = 2;
                    SumLengths += FeatLength;

                    UnitSumLen = SumLengths;

                    txtMessage.Text = "线要素" + "\r\n线段长度是:" + FeatLength + outUnit.UnitName;
                    if (tbtnSum.Checked == true)
                    {
                        txtMessage.Text += "\r\n" + "\r\n 线段长度之和是:" + SumLengths + outUnit.UnitName;
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    IPolygon pFeatPolygon   = (IPolygon)pGeo;
                    IArea    pFeatArea      = (IArea)pFeatPolygon;
                    double   pFeatPerimeter = CntUnit.ConvertUnits(pFeatPolygon.Length, inUnit.pUnit, outUnit.pUnit);
                    m_TotLen.value = pFeatPerimeter;
                    m_TotLen.units = outUnit.pUnit;
                    shapeType      = 3;

                    pFeatPerimeter = Math.Round(pFeatPerimeter, 6);
                    SumPerimeters += pFeatPerimeter;
                    double parea    = pFeatArea.Area;
                    double Cntparea = parea;
                    string AreaUnitMess;
                    Cntparea     = ConvertToArea(Cntparea, inAreaUnit.UnitName, outAreaUnit.UnitName);
                    m_Area.value = Cntparea;
                    m_Area.units = outAreaUnit.pUnit;
                    if (outAreaUnit.UnitName == "Unkown Units")
                    {
                        AreaUnitMess = outAreaUnit.UnitName;
                    }
                    else
                    {
                        AreaUnitMess = " Square " + outAreaUnit.UnitName;
                    }
                    Cntparea  = Math.Round(Cntparea, 6);
                    SumAreas += Cntparea;

                    UnitSumPeri     = SumPerimeters;
                    UnitSumArea     = SumAreas;
                    txtMessage.Text = "面要素" + "\r\n周长是:" + pFeatPerimeter + outUnit.UnitName + "\r\n面积是:" + Cntparea + AreaUnitMess;
                    if (tbtnSum.Checked == true)
                    {
                        txtMessage.Text += "\r\n" + "\r\n周长长度之和是:" + SumPerimeters + outUnit.UnitName + "\r\n面积之和是:" + SumAreas + AreaUnitMess;
                    }
                    break;
                }
            }

            return(pFeat);
        }
コード例 #38
0
 public static ActuatorId Create(IArea room, Enum id)
 {
     return(new ActuatorId(room.Id + "." + id));
 }
コード例 #39
0
 public async Task StartSimulatingArea(IArea area)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
 public AreaProfile(AreaCode areaCode, float size, IArea source)
 {
     Source   = source;
     AreaCode = areaCode;
     Size     = size;
 }
コード例 #41
0
 public AreaChecked(IArea area)
 {
     Area = area;
 }
コード例 #42
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Lady Grynoch", eRealm.Albion);

            if (npcs.Length == 0)
            {
                LadyGrynoch       = new GameNPC();
                LadyGrynoch.Model = 5;
                LadyGrynoch.Name  = "Lady Grynoch";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + LadyGrynoch.Name + ", creating her ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // LadyGrynoch.GuildName = "Part of " + questTitle + " Quest";
                LadyGrynoch.Realm           = eRealm.Albion;
                LadyGrynoch.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);    // Slot 25
                LadyGrynoch.Inventory = template.CloseTemplate();
                LadyGrynoch.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                LadyGrynoch.Size    = 51;
                LadyGrynoch.Level   = 38;
                LadyGrynoch.X       = 559698;
                LadyGrynoch.Y       = 513578;
                LadyGrynoch.Z       = 2428;
                LadyGrynoch.Heading = 2742;

                if (SAVE_INTO_DATABASE)
                {
                    LadyGrynoch.SaveIntoDatabase();
                }

                LadyGrynoch.AddToWorld();
            }
            else
            {
                LadyGrynoch = npcs[0];
            }

            Burial_Tomb_Area = WorldMgr.GetRegion(Burial_Tomb.RegionID).AddArea(new Area.Circle(string.Empty, Burial_Tomb.X, Burial_Tomb.Y, Burial_Tomb.Z, 200));
            Burial_Tomb_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterBurialTombArea));

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.Interact, new DOLEventHandler(TalkToLadyGrynoch));
            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLadyGrynoch));

            LadyGrynoch.AddQuestToGive(typeof(TombWithAView));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
コード例 #43
0
 /// <inheritdoc cref="SelectAreaId(IViewModelField, int, IArea?)"/>
 public static void SelectArea(this IViewModelField v, IArea area) => v.SelectAreaId(area.Id);
コード例 #44
0
        public void frmDbClick(ref INewPolygonFeedback m_FeedbackPolygon, ref IGeometry m_Geometry)
        {
            if (tbtnArea.Checked == true)
            {
                if (m_FeedbackPolygon != null)
                {
                    pGeometry         = m_FeedbackPolygon.Stop();
                    m_Geometry        = pGeometry;
                    m_FeedbackPolygon = null;
                }

                IPolygon pPloygon = (IPolygon)pGeometry;
                Perimeter      = pPloygon.Length;
                Perimeter      = CntUnit.ConvertUnits(Perimeter, inUnit.pUnit, outUnit.pUnit);
                m_TotLen.value = Perimeter;
                m_TotLen.units = outUnit.pUnit;
                SegAreaLength  = LastSegArea;
                double CntSegAreaLength = CntUnit.ConvertUnits(SegAreaLength, inUnit.pUnit, outUnit.pUnit);
                m_SegLen.value = CntSegAreaLength;
                m_SegLen.units = outUnit.pUnit;
                pArea          = (IArea)pPloygon;
                myArea         = Math.Abs(pArea.Area);
                double CntmyArea = myArea;
                CntmyArea    = ConvertToArea(CntmyArea, inAreaUnit.UnitName, outAreaUnit.UnitName);
                m_Area.value = CntmyArea;
                m_Area.units = outAreaUnit.pUnit;
                string AreaUnitMess;

                if (outAreaUnit.UnitName == "Unkown Units")
                {
                    AreaUnitMess = outAreaUnit.UnitName;
                }
                else
                {
                    AreaUnitMess = "Square " + outAreaUnit.UnitName;
                }

                Perimeter      = Math.Round(Perimeter, 6);
                SumPerimeters += Perimeter;

                CntSegAreaLength = Math.Round(CntSegAreaLength, 6);
                CntmyArea        = Math.Round(CntmyArea, 6);
                SumAreas        += CntmyArea;
                UnitSumArea      = SumAreas;
                UnitSumPeri      = SumPerimeters;
                txtMessage.Text  = "测量面" + "\r\n线段长是" + CntSegAreaLength + outUnit.UnitName + "\r\n周长是:" + Perimeter + outUnit.UnitName + "\r\n面积是:" + CntmyArea + AreaUnitMess;
                if (tbtnSum.Checked == true)
                {
                    txtMessage.Text += "\r\n" + "\r\n周长长度之和是:" + SumPerimeters + outUnit.UnitName + "\r\n面积之和是:" + SumAreas + AreaUnitMess;
                }
            }

            TotalLength     = 0.0;
            SegLength       = 0.0;
            TotalAreaLength = 0.0;
            SegAreaLength   = 0.0;
            myArea          = 0.0;
            Perimeter       = 0.0;
            pCollection     = new MultipointClass();
            pGeometry       = null;
        }
コード例 #45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Rover"/> class.
 /// </summary>
 /// <param name="roverPosition">
 /// The rover position.
 /// </param>
 /// <param name="roverCompass">
 /// The rover compass.
 /// </param>
 /// <param name="roverArea">
 /// The rover area.
 /// </param>
 public Rover(IPosition roverPosition, Compass roverCompass, IArea roverArea)
 {
     this.RoverPosition = roverPosition;
     this.RoverCompass  = roverCompass;
     this.RoverArea     = roverArea;
 }
コード例 #46
0
        public void Verify()
        {
            foreach (IPage Page in Pages)
            {
                IFormCollection <IArea> UsedAreas = new FormCollection <IArea>();
                Dictionary <IArea, IDeclarationSource> SpecifiedAreas = new Dictionary <IArea, IDeclarationSource>();
                foreach (KeyValuePair <IArea, ILayout> Entry in Page.AreaLayouts)
                {
                    UsedAreas.Add(Entry.Key);
                }

                ListAreas(Page.Area, Page.AreaSource, UsedAreas, SpecifiedAreas);

                if (UsedAreas.Count > 0)
                {
                    IArea SpecifiedArea = UsedAreas[0];
                    if (Page.AreaLayoutBacktracks.ContainsKey(SpecifiedArea))
                    {
                        throw new ParsingException(9, Page.AreaLayoutBacktracks[SpecifiedArea].Source, $"Layout specified for area '{SpecifiedArea.Name}' but this area isn't used in page '{Page.Name}'.");
                    }
                    else
                    {
                        throw new ParsingException(9, Page.AreaSource.Source, $"Layout specified for area '{SpecifiedArea.Name}' but this area isn't used in page '{Page.Name}'.");
                    }
                }

                foreach (KeyValuePair <IArea, IDeclarationSource> Entry in SpecifiedAreas)
                {
                    IArea SpecifiedArea = Entry.Key;

                    if (!Page.AreaLayouts.ContainsKey(SpecifiedArea))
                    {
                        throw new ParsingException(10, Page.AllAreaLayoutsSource, $"Area '{SpecifiedArea.Name}' has not layout specified.");
                    }

                    if (ComponentProperty.AreaWithCurrentPage.ContainsKey(SpecifiedArea))
                    {
                        IDeclarationSource Declaration = ComponentProperty.AreaWithCurrentPage[SpecifiedArea];

                        string PageKey = ParserDomain.ToKeyName($"page {Page.Name}");
                        if (Translation == null)
                        {
                            throw new ParsingException(11, Declaration.Source, $"Translation key used in area '{SpecifiedArea.Name}' but no translation file provided.");
                        }
                        if (!Translation.KeyList.Contains(PageKey))
                        {
                            throw new ParsingException(12, Declaration.Source, $"Translation key for page '{Page.Name}' used in area '{SpecifiedArea.Name}' not found.");
                        }

                        if (!Translation.UsedKeyList.Contains(PageKey))
                        {
                            Translation.UsedKeyList.Add(PageKey);
                        }
                    }

                    ILayout SpecifiedLayout = Page.AreaLayouts[SpecifiedArea];
                    foreach (IComponent Component in SpecifiedArea.Components)
                    {
                        if (Component is IComponentWithEvent AsComponentWithEvent)
                        {
                            List <IControl> ControlList = new List <IControl>();
                            SpecifiedLayout.Content.ReportControlsUsingComponent(ControlList, AsComponentWithEvent);
                            if (ControlList.Count > 1)
                            {
                                throw new ParsingException(220, Component.Source.Source, $"Component '{Component.Source.Name}' is used more than once in page '{Page.Name}'.");
                            }
                        }
                    }
                }

                List <string> KeyList = new List <string>();
                foreach (KeyValuePair <IArea, ILayout> Entry in Page.AreaLayouts)
                {
                    Entry.Value.ReportResourceKeys(Page.Design, KeyList);
                }

                List <string> DesignKeyList = new List <string>();
                foreach (object Key in Page.Design.Root)
                {
                    if (Key is DictionaryEntry AsEntry)
                    {
                        if (AsEntry.Key is string AsStringKey)
                        {
                            DesignKeyList.Add(AsStringKey);
                        }
                        else if (AsEntry.Key is Type AsTypeKey)
                        {
                            DesignKeyList.Add($"{Page.Design.XamlName}{ParserDomain.StyleTypeConverter(AsTypeKey.Name)}");
                        }
                        else
                        {
                            throw new ParsingException(240, "", $"Unexpected key in design '{Page.Design.Name}'.");
                        }
                    }
                    else
                    {
                        throw new ParsingException(240, "", $"Unexpected key in design '{Page.Design.Name}'.");
                    }
                }

                foreach (string Key in KeyList)
                {
                    if (!DesignKeyList.Contains(Key) && !Key.EndsWith("DesignHtml"))
                    {
                        throw new ParsingException(241, "", $"Resource key '{Key}' not found in design '{Page.Design.Name}'.");
                    }
                }
            }

            VerifyAttachedProperties();
        }
コード例 #47
0
ファイル: Form1.cs プロジェクト: 305120262/CachedLayerSystem
        /// <summary>
        /// Build Cache Backgroud worker
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            int           size   = int.Parse(this.tbxSize.Text);
            IFeatureClass fc_poi = m_fcName.Open() as IFeatureClass;
            IGeoDataset   ds_poi = fc_poi as IGeoDataset;
            int           xmin   = (int)Math.Floor(ds_poi.Extent.XMin);
            int           ymin   = (int)Math.Floor(ds_poi.Extent.YMin);
            int           xmax   = (int)Math.Ceiling(ds_poi.Extent.XMax);
            int           ymax   = (int)Math.Ceiling(ds_poi.Extent.YMax);

            List <JsonObject> ls_fields_cache = new List <JsonObject>();

            if (!(fc_poi.Extension is IAnnotationClassExtension))
            {
                for (int i = 0; i < fc_poi.Fields.FieldCount; i++)
                {
                    IField     field = fc_poi.Fields.get_Field(i);
                    JsonObject js_f  = new JsonObject();
                    js_f.AddString("name", field.Name);
                    js_f.AddString("type", Enum.GetName(typeof(esriFieldType), field.Type));
                    js_f.AddString("alias", field.AliasName);
                    if (field.Type == esriFieldType.esriFieldTypeString)
                    {
                        js_f.AddString("length", field.Length.ToString());
                    }
                    else
                    {
                        js_f.AddString("length", "");
                    }
                    ls_fields_cache.Add(js_f);
                }
            }

            IDatabase client  = m_redis.GetDatabase();
            int       grid_id = 0;
            string    ns      = "poi:" + this.tbxCacheName.Text + ":";

            for (int y = ymin; y <= ymax; y += size)
            {
                for (int x = xmin; x <= xmax; x += size)
                {
                    List <String>     str_poi_grid = new List <String>();
                    List <JsonObject> ls_features  = new List <JsonObject>();
                    //String str_response = client.StringGet(ns+"response");
                    //JsonObject response = new JsonObject(str_response);
                    JsonObject response = new JsonObject();
                    IEnvelope  box      = new EnvelopeClass();
                    box.XMin = x;
                    box.YMin = y;
                    box.XMax = x + size;
                    box.YMax = y + size;
                    ISpatialFilter filter_poi = new SpatialFilterClass();
                    filter_poi.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                    filter_poi.Geometry   = box;
                    filter_poi.SubFields  = "*";
                    IFeatureCursor cur_poi = fc_poi.Search(filter_poi, true);
                    IFeature       fea_poi = cur_poi.NextFeature();
                    while (fea_poi != null)
                    {
                        JsonObject js_fea = new JsonObject();
                        if (!(fea_poi is IAnnotationFeature))
                        {
                            JsonObject js_attributes = new JsonObject();
                            int        i             = 0;
                            foreach (JsonObject js_field in ls_fields_cache)
                            {
                                object value = fea_poi.get_Value(i);
                                string fieldtype;
                                js_field.TryGetString("type", out fieldtype);
                                string fieldname;
                                js_field.TryGetString("name", out fieldname);
                                #region
                                if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeString))
                                {
                                    js_attributes.AddString(fieldname, value.ToString());
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeOID))
                                {
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeInteger))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeSmallInteger))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeDouble))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddDouble(fieldname, double.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeDate))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = DateTime.MinValue;
                                    }
                                    js_attributes.AddDate(fieldname, DateTime.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeSingle))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddBoolean(fieldname, bool.Parse(value.ToString()));
                                }
                                #endregion
                                i++;
                            }
                            js_fea.AddJsonObject("attributes", js_attributes);
                            js_fea.AddJsonObject("geometry", Conversion.ToJsonObject(fea_poi.Shape));
                        }
                        else
                        {
                            IAnnotationFeature anno_fea = fea_poi as IAnnotationFeature;
                            ITextElement       ele      = anno_fea.Annotation as ITextElement;
                            //string text = ele.Text.Replace(System.Environment.NewLine, " ");
                            string      text     = ele.Text;
                            ITextSymbol sym      = ele.Symbol;
                            IFontDisp   font     = sym.Font;
                            double      symsize  = sym.Size;
                            string      fontname = font.Name;
                            decimal     fontsize = font.Size;
                            string.Format(@"a"":""");
                            JsonObject js_symbol = new JsonObject(
                                string.Format(@"{{""type"" : ""esriTS"",""color"": [255,255,255],""haloSize"" : 0,""haloColor"" : [255,255,255,0],""verticalAlignment"" : ""bottom"",""horizontalAlignment"" : ""center"",""size"": {0},""angle"": 0,""xoffset"": 0,""yoffset"": 0,""font"" : {{""family"" : ""{2}"",""size"" : {3},""style"" : ""normal"",""weight"" : ""normal"",""decoration"" : ""none""}},""text"":""{1}""}}", symsize, text, fontname, fontsize));
                            js_fea.AddJsonObject("symbol", js_symbol);
                            IArea pshp = fea_poi.Shape as IArea;
                            js_fea.AddJsonObject("geometry", Conversion.ToJsonObject(pshp.Centroid));
                        }
                        ls_features.Add(js_fea);
                        fea_poi = cur_poi.NextFeature();
                    }
                    response.AddArray("features", ls_features.ToArray());
                    client.StringSet(ns + grid_id.ToString(), response.ToJson());
                    ReleaseCOMObject(cur_poi);
                    grid_id++;
                    progressBar1.BeginInvoke((Action)(() =>
                    {
                        progressBar1.Increment(1);
                    }));
                }
            }
            MessageBox.Show("Build Cache Successfully!");
            this.button1.BeginInvoke((Action)(() =>
            {
                ListCaches();
                this.button1.Enabled = true;
            }));
        }
コード例 #48
0
        private IImage createImage(IArea area, IBitmap bg)
        {
            var bitmap = bg.ApplyArea(area);

            return(_factory.Graphics.LoadImage(bitmap));
        }
コード例 #49
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedItem.ToString() == "")
            {
                MessageBox.Show("请选择有效图层!");
                return;
            }
            if (this.textBox1.Text == "")
            {
                MessageBox.Show("请输入相对高程下限!");
                return;
            }
            if (this.textBox2.Text == "")
            {
                MessageBox.Show("请输入相对高程上限!");
                return;
            }
            if (this.textBox1.Text != "")
            {
                if (!IsNumeric(this.textBox1.Text.ToString()))
                {
                    MessageBox.Show("请输入数字!");
                    return;
                }
            }
            if (this.textBox2.Text != "")
            {
                if (!IsNumeric(this.textBox1.Text.ToString()))
                {
                    MessageBox.Show("请输入数字!");
                    return;
                }
            }
            IWorkspaceFactory m_workspaceFactory = new ShapefileWorkspaceFactoryClass();
            IFeatureWorkspace featureWorkspce    = m_workspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
            IFeatureClass     feaC = featureWorkspce.OpenFeatureClass("test");

            if (this.textBox1.Text == "0")
            {
                IFeatureCursor feaCur   = feaC.Search(null, true);
                IFeature       pFeature = feaCur.NextFeature();
                IArea          area     = pFeature.Shape as IArea;
                double         areaD    = Math.Abs(area.Area) / 3;
                this.label11.Text = areaD.ToString("#######") + "平方米";
                while (pFeature != null)
                {
                    pFeature.set_Value(2, this.m_tin.Extent.ZMin + Convert.ToDouble(this.textBox2.Text.ToString()));
                    pFeature.Store();
                    pFeature = feaCur.NextFeature();
                }
                IDataset          pDataset          = feaC as IDataset;
                IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                IFeatureWorkspace pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                IWorkspace        pWorkspace        = pFeatureWorkspace as IWorkspace;
                pDataset.Copy("test2", pFeatureWorkspace as IWorkspace);

                pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                IFeatureClass fea2 = pFeatureWorkspace.OpenFeatureClass("test2");

                TinPolygonVolume ff = new TinPolygonVolume(m_tin, fea2, "HEIGHT");
                ff.reference_plane = "BELOW";
                Geoprocessor gp = new Geoprocessor();
                gp.Execute(ff, null);
                feaCur   = fea2.Search(null, true);
                pFeature = feaCur.NextFeature();

                while (pFeature != null)
                {
                    double volume = (double)pFeature.get_Value(3);
                    this.label7.Text = volume.ToString("#######") + "立方米";
                    double sarea = (double)pFeature.get_Value(4);
                    this.label8.Text = sarea.ToString("#######") + "平方米";
                    pFeature         = feaCur.NextFeature();
                }
            }
            else
            {
                IFeatureCursor feaCur   = feaC.Search(null, true);
                IFeature       pFeature = feaCur.NextFeature();
                IArea          area     = pFeature.Shape as IArea;
                double         areaD    = Math.Abs(area.Area) / 3;
                this.label11.Text = areaD.ToString("#######") + "平方米";
                while (pFeature != null)
                {
                    pFeature.set_Value(2, this.m_tin.Extent.ZMin + Convert.ToDouble(this.textBox2.Text.ToString()));
                    pFeature.Store();
                    pFeature = feaCur.NextFeature();
                }
                IDataset          pDataset          = feaC as IDataset;
                IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                IFeatureWorkspace pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                IWorkspace        pWorkspace        = pFeatureWorkspace as IWorkspace;
                pDataset.Copy("test2", pFeatureWorkspace as IWorkspace);

                pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                IFeatureClass fea2 = pFeatureWorkspace.OpenFeatureClass("test2");

                TinPolygonVolume ff = new TinPolygonVolume(m_tin, fea2, "HEIGHT");
                ff.reference_plane = "BELOW";
                Geoprocessor gp = new Geoprocessor();
                gp.Execute(ff, null);
                feaCur   = fea2.Search(null, true);
                pFeature = feaCur.NextFeature();
                double volume1 = 0;
                double sarea1  = 0;
                while (pFeature != null)
                {
                    volume1 = (double)pFeature.get_Value(3);
                    //this.label7.Text = volume.ToString("#######") + "立方米";
                    sarea1 = (double)pFeature.get_Value(4);
                    //this.label8.Text = sarea.ToString("#######") + "平方米";
                    pFeature = feaCur.NextFeature();
                }

                feaCur   = feaC.Search(null, true);
                pFeature = feaCur.NextFeature();
                double volume2 = 0;
                double sarea2  = 0;
                while (pFeature != null)
                {
                    pFeature.set_Value(2, this.m_tin.Extent.ZMin + Convert.ToDouble(this.textBox1.Text.ToString()));
                    pFeature.Store();
                    pFeature = feaCur.NextFeature();
                }
                pDataset          = feaC as IDataset;
                pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                pWorkspace        = pFeatureWorkspace as IWorkspace;
                pDataset.Copy("test3", pFeatureWorkspace as IWorkspace);

                pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(Application.StartupPath + "\\tempSHP", 0) as IFeatureWorkspace;
                fea2 = pFeatureWorkspace.OpenFeatureClass("test3");

                ff = new TinPolygonVolume(m_tin, fea2, "HEIGHT");
                ff.reference_plane = "BELOW";
                gp = new Geoprocessor();
                gp.Execute(ff, null);
                feaCur   = fea2.Search(null, true);
                pFeature = feaCur.NextFeature();
                while (pFeature != null)
                {
                    volume2 = (double)pFeature.get_Value(3);
                    //this.label7.Text = volume.ToString("#######") + "立方米";
                    sarea2 = (double)pFeature.get_Value(4);
                    //this.label8.Text = sarea.ToString("#######") + "平方米";
                    pFeature = feaCur.NextFeature();
                }
                double volume = volume1 - volume2;
                double sarea  = sarea1 - sarea2;
                this.label7.Text = volume.ToString("#######") + "立方米";
                this.label8.Text = sarea.ToString("#######") + "平方米";
            }

            string[] files = System.IO.Directory.GetFiles(Application.StartupPath + "\\tempSHP");
            for (int i = 0; i < files.Length; i++)
            {
                System.IO.File.Delete(files[i]);
            }
        }
コード例 #50
0
ファイル: mainForm.cs プロジェクト: hehao1999/GIS
        //鼠标移动
        private void MainMapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
        {
            sMapUnits = GetMapUnit(mainMapControl.Map.MapUnits);
            mainform.toolStripStatusLabel1.Text = String.Format("当前坐标:X = {0:#.###} Y = {1:#.###} {2}", e.mapX, e.mapY, sMapUnits);
            try
            {
                frmMeasureResult.label2.Text = String.Format("当前坐标:X = {0:#.###} Y = {1:#.###} {2}", e.mapX, e.mapY, sMapUnits);
            }
            catch
            {
                ;
            }

            pMovePt = (mainMapControl.Map as IActiveView).ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);

            if (pMouseOperate == "MeasureLength")
            {
                if (pNewLineFeedback != null)
                {
                    pNewLineFeedback.MoveTo(pMovePt);
                }
                double deltaX = 0; //两点之间X差值
                double deltaY = 0; //两点之间Y差值

                if ((pPointPt != null) && (pNewLineFeedback != null))
                {
                    deltaX         = pMovePt.X - pPointPt.X;
                    deltaY         = pMovePt.Y - pPointPt.Y;
                    dSegmentLength = Math.Round(Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY)), 3);
                    dToltalLength  = dToltalLength + dSegmentLength;
                    if (frmMeasureResult != null)
                    {
                        frmMeasureResult.label2.Text = String.Format(
                            "当前线段长度:{0:.###}{1};\r\n总长度为: {2:.###}{1}",
                            dSegmentLength, sMapUnits, dToltalLength);
                        dToltalLength = dToltalLength - dSegmentLength; //鼠标移动到新点重新开始计算
                    }
                    frmMeasureResult.frmClosed += new FormMeasureResult.FormClosedEventHandler(frmMeasureResult_frmColsed);
                }
            }
            if (pMouseOperate == "MeasureArea")
            {
                if (pNewPolygonFeedback != null)
                {
                    pNewPolygonFeedback.MoveTo(pMovePt);
                }

                IPointCollection pPointCol = new Polygon();
                IPolygon         pPolygon  = new PolygonClass();
                IGeometry        pGeo      = null;

                ITopologicalOperator pTopo = null;
                for (int i = 0; i <= pAreaPointCol.PointCount - 1; i++)
                {
                    pPointCol.AddPoint(pAreaPointCol.get_Point(i), ref missing, ref missing);
                }
                pPointCol.AddPoint(pMovePt, ref missing, ref missing);

                if (pPointCol.PointCount < 3)
                {
                    return;
                }
                pPolygon = pPointCol as IPolygon;

                if ((pPolygon != null))
                {
                    pPolygon.Close();
                    pGeo  = pPolygon as IGeometry;
                    pTopo = pGeo as ITopologicalOperator;
                    //使几何图形的拓扑正确
                    pTopo.Simplify();
                    pGeo.Project(mainMapControl.Map.SpatialReference);
                    IArea pArea = pGeo as IArea;

                    frmMeasureResult.label2.Text = String.Format("总面积为:{0:.####}平方{1};\r\n总长度为:{2:.####}{1}", pArea.Area, sMapUnits, pPolygon.Length);
                    pPolygon = null;
                }
            }
        }
コード例 #51
0
        private void PRV_GetErrorFeature()
        {
            foreach (ITopologyRule IN_RuleType in LI_ITopologyRule)
            {
                int tempCount = 0;
                DicTopoError.Add(IN_RuleType.OriginSubtype.ToString(), tempCount);
                IEnvelope Temp_Envolope = (this.Topology as IGeoDataset).Extent;
                IErrorFeatureContainer Temp_ErrorContainer = Topology as IErrorFeatureContainer;
                //获取该种错误所有的错误要素
                IEnumTopologyErrorFeature Temp_EnumErrorFeature = Temp_ErrorContainer.get_ErrorFeatures(((IGeoDataset)FeatureDataset_Main).SpatialReference, IN_RuleType, Temp_Envolope, true, false);
                //提取一个错误要素
                ITopologyErrorFeature Temp_ErrorFeature = Temp_EnumErrorFeature.Next();
                if (Temp_ErrorFeature != null)
                {
                    //作为搭建模型的要素
                    IFeature Temp_MoudleFeature = Temp_ErrorFeature as IFeature;
                    //生成要素类需要CLSID和EXCLSID
                    IFeatureClassDescription Temp_FeatureClassDescription = new FeatureClassDescriptionClass();
                    IObjectClassDescription  Temp_ObjectClassDescription  = (IObjectClassDescription)Temp_FeatureClassDescription;
                    //以模型要素为模板构建一个要素类
                    //FeatureDataset_Main.CreateFeatureClass(TP_topoName, Temp_MoudleFeature.Fields, Temp_ObjectClassDescription.InstanceCLSID, Temp_ObjectClassDescription.ClassExtensionCLSID, Temp_MoudleFeature.FeatureType, "Shape", null);
                    //打开生成的目标要素类并加入集合留待输出时使用
                    IFeatureClass Temp_TargetFeatureClass;
                    string        ErrorFeatureName = TP_topoName + "_" + Temp_ErrorFeature.ShapeType.ToString();
                    try
                    {
                        Temp_TargetFeatureClass = (FeatureDataset_Main.Workspace as IFeatureWorkspace).OpenFeatureClass(ErrorFeatureName);
                    }
                    catch
                    {
                        FeatureDataset_Main.CreateFeatureClass(ErrorFeatureName, Temp_MoudleFeature.Fields, Temp_ObjectClassDescription.InstanceCLSID, Temp_ObjectClassDescription.ClassExtensionCLSID, Temp_MoudleFeature.FeatureType, "Shape", null);
                        Temp_TargetFeatureClass = (FeatureDataset_Main.Workspace as IFeatureWorkspace).OpenFeatureClass(ErrorFeatureName);
                    }
                    LI_TopoErrorFeatureClass.Add(Temp_TargetFeatureClass);
                    //将所有错误要素添加进目标要素类
                    IWorkspaceEdit Temp_WorkspaceEdit = (IWorkspaceEdit)FeatureDataset_Main.Workspace;
                    Temp_WorkspaceEdit.StartEditing(true);
                    Temp_WorkspaceEdit.StartEditOperation();
                    IFeatureBuffer Temp_FeatureBuffer = Temp_TargetFeatureClass.CreateFeatureBuffer();

                    //在目标要素类中插入所有错误要素
                    IFeatureCursor featureCursor = Temp_TargetFeatureClass.Insert(false);
                    while (Temp_ErrorFeature != null)
                    {
                        IFeature Temp_Feature = Temp_ErrorFeature as IFeature;
                        //给目标要素附属性
                        Temp_FeatureBuffer.set_Value(1, Temp_ErrorFeature.OriginClassID);
                        Temp_FeatureBuffer.set_Value(2, Temp_ErrorFeature.OriginOID);
                        Temp_FeatureBuffer.set_Value(3, Temp_ErrorFeature.DestinationClassID);
                        Temp_FeatureBuffer.set_Value(4, Temp_ErrorFeature.DestinationOID);
                        Temp_FeatureBuffer.set_Value(5, Temp_ErrorFeature.TopologyRuleType);
                        Temp_FeatureBuffer.set_Value(8, Temp_ErrorFeature.IsException);
                        Temp_FeatureBuffer.Shape = Temp_Feature.Shape;
                        if (this.DicTopoData.ContainsKey(IN_RuleType.OriginSubtype.ToString()))
                        {
                            if (IN_RuleType.Name == "面要素之间无空隙")
                            {
                                IArea pArea = (IArea)Temp_Feature.Shape.Envelope;
                                if (pArea.Area < System.Convert.ToDouble(this.DicTopoData[IN_RuleType.OriginSubtype.ToString()]))
                                {
                                    tempCount++;
                                    DicTopoError[IN_RuleType.OriginSubtype.ToString()] = tempCount;
                                    object featureOID = featureCursor.InsertFeature(Temp_FeatureBuffer);
                                    featureCursor.Flush();//保存要素
                                }
                            }
                        }
                        else
                        {
                            tempCount++;
                            DicTopoError[IN_RuleType.OriginSubtype.ToString()] = tempCount;
                            object featureOID = featureCursor.InsertFeature(Temp_FeatureBuffer);
                            featureCursor.Flush();//保存要素
                        }
                        Temp_ErrorFeature = Temp_EnumErrorFeature.Next();
                    }
                    Temp_WorkspaceEdit.StopEditOperation();
                    Temp_WorkspaceEdit.StopEditing(true);
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);
                }
            }
        }
コード例 #52
0
ファイル: ComponentProperty.cs プロジェクト: dlebansais/Wrist
        public bool ConnectToResourceOrObject(IDomain domain, IArea currentArea, IObject currentObject, ref IResource resource, ref IObject obj, ref IObjectProperty objectProperty, ref IDeclarationSource objectPropertyKey)
        {
            bool IsConnected = false;

            if (FixedValueSource != null && resource == null)
            {
                foreach (IResource Item in domain.Resources)
                {
                    if (Item.Name == FixedValueSource.Name)
                    {
                        resource = Item;
                        break;
                    }
                }

                if (resource == null)
                {
                    throw new ParsingException(142, FixedValueSource.Source, $"Unknown static resource '{FixedValueSource.Name}'.");
                }

                IsConnected = true;
            }

            else if ((ObjectSource != null || ObjectPropertySource != null) && (obj == null || objectProperty == null))
            {
                ConnectToObject(domain, currentArea, ObjectSource, ObjectPropertySource, ObjectPropertyKey, ref obj);

                foreach (IObjectProperty Property in obj.Properties)
                {
                    if (Property.NameSource.Name == ObjectPropertySource.Name)
                    {
                        if (Property is IObjectPropertyStringDictionary AsObjectPropertyStringDictionary)
                        {
                            if (ObjectPropertyKey == null)
                            {
                                throw new ParsingException(143, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' must be used with a key.");
                            }
                        }
                        else
                        {
                            if (ObjectPropertyKey != null)
                            {
                                throw new ParsingException(144, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' cannot be used with a key.");
                            }
                        }

                        objectProperty    = Property;
                        objectPropertyKey = ObjectPropertyKey;
                        break;
                    }
                }

                if (objectProperty == null)
                {
                    throw new ParsingException(141, ObjectPropertySource.Source, $"Unknown property '{ObjectPropertySource.Name}' in object '{obj.Name}'.");
                }

                IsConnected = true;
            }

            return(IsConnected);
        }
コード例 #53
0
 private async Task SpendTimeInArea(Flight flight, IArea area)
 {
     await Task.Delay(area.SpendingMinutes + 2000);
 }
コード例 #54
0
ファイル: ComponentProperty.cs プロジェクト: dlebansais/Wrist
        private static void ConnectToObject(IDomain domain, IArea currentArea, IDeclarationSource objectSource, IDeclarationSource objectPropertySource, IDeclarationSource objectPropertyKey, ref IObject obj)
        {
            if (objectSource.Name == Object.TranslationObject.Name)
            {
                if (domain.Translation == null)
                {
                    throw new ParsingException(11, objectSource.Source, $"Object '{objectSource.Name}' is used but no translation file is specified.");
                }

                obj = Object.TranslationObject;
                if (objectPropertySource.Name != ObjectPropertyStringDictionary.StringsProperty.NameSource.Name)
                {
                    throw new ParsingException(137, objectPropertySource.Source, $"The only valid property for object '{objectSource.Name}' is '{ObjectPropertyStringDictionary.StringsProperty.NameSource.Name}'.");
                }

                if (objectPropertyKey == null)
                {
                    throw new ParsingException(138, objectSource.Source, $"For object '{objectSource.Name}' property '{objectPropertySource.Name}' a key is required.");
                }

                if (objectPropertyKey.Name != Page.CurrentPage.Name)
                {
                    if (!domain.Translation.KeyList.Contains(objectPropertyKey.Name))
                    {
                        throw new ParsingException(139, objectPropertyKey.Source, $"The translation file doesn't contain key '{objectPropertyKey.Name}'.");
                    }

                    if (!domain.Translation.UsedKeyList.Contains(objectPropertyKey.Name))
                    {
                        domain.Translation.UsedKeyList.Add(objectPropertyKey.Name);
                    }
                }
                else
                {
                    // Verify it later
                    if (!AreaWithCurrentPage.ContainsKey(currentArea))
                    {
                        AreaWithCurrentPage.Add(currentArea, objectPropertyKey);
                    }
                }
            }

            else if (objectSource.Name == Object.ApplicationObject.Name)
            {
                obj = Object.ApplicationObject;
                if (objectPropertySource.Name != ObjectPropertyItemList.NavigationHistoryProperty.NameSource.Name && objectPropertySource.Name != ObjectPropertyInteger.NavigationIndexProperty.NameSource.Name)
                {
                    throw new ParsingException(137, objectPropertySource.Source, $"The only valid property for object '{objectSource.Name}' is '{ObjectPropertyItemList.NavigationHistoryProperty.NameSource.Name}' or '{ObjectPropertyInteger.NavigationIndexProperty.NameSource.Name}'.");
                }

                if (objectPropertyKey != null)
                {
                    throw new ParsingException(0, objectSource.Source, $"For object '{objectSource.Name}' property '{objectPropertySource.Name}' there must be no key.");
                }
            }
            else
            {
                foreach (IObject Item in domain.Objects)
                {
                    if (Item.Name == objectSource.Name)
                    {
                        obj = Item;
                        break;
                    }
                }

                if (obj == null)
                {
                    throw new ParsingException(140, objectSource.Source, $"Unknown object '{objectSource.Name}'.");
                }

                obj.SetIsUsed();
            }
        }
コード例 #55
0
        private void SetupLight(StateMachine light, HSREL8 hsrel8, HSPE8OutputOnly hspe8, IArea room)
        {
            // Front lights (left, middle, right)
            var fl = hspe8[HSPE8Pin.GPIO0].WithInvertedState();
            var fm = hspe8[HSPE8Pin.GPIO2].WithInvertedState();
            var fr = hsrel8[HSREL8Pin.GPIO0].WithInvertedState();

            // Middle lights (left, middle, right)
            var ml = hspe8[HSPE8Pin.GPIO1].WithInvertedState();
            var mm = hspe8[HSPE8Pin.GPIO3].WithInvertedState();
            var mr = hsrel8[HSREL8Pin.GPIO1].WithInvertedState();

            // Rear lights (left, right)
            // Two mechanical relays.
            var rl = hsrel8[HSREL8Pin.GPIO5];
            var rr = hsrel8[HSREL8Pin.GPIO4];

            light.AddOffState()
            .WithLowOutput(fl)
            .WithLowOutput(fm)
            .WithLowOutput(fr)
            .WithLowOutput(ml)
            .WithLowOutput(mm)
            .WithLowOutput(mr)
            .WithLowOutput(rl)
            .WithLowOutput(rr);

            light.AddOnState()
            .WithHighOutput(fl)
            .WithHighOutput(fm)
            .WithHighOutput(fr)
            .WithHighOutput(ml)
            .WithHighOutput(mm)
            .WithHighOutput(mr)
            .WithHighOutput(rl)
            .WithHighOutput(rr);

            var deskOnlyStateId = new ComponentState("DeskOnly");

            light.AddState(deskOnlyStateId)
            .WithHighOutput(fl)
            .WithHighOutput(fm)
            .WithLowOutput(fr)
            .WithHighOutput(ml)
            .WithLowOutput(mm)
            .WithLowOutput(mr)
            .WithLowOutput(rl)
            .WithLowOutput(rr);

            var couchOnlyStateId = new ComponentState("CouchOnly");

            light.AddState(couchOnlyStateId)
            .WithLowOutput(fl)
            .WithLowOutput(fm)
            .WithLowOutput(fr)
            .WithLowOutput(ml)
            .WithLowOutput(mm)
            .WithLowOutput(mr)
            .WithLowOutput(rl)
            .WithHighOutput(rr);

            light.WithTurnOffIfStateIsAppliedTwice();

            room.GetButton(Office.ButtonLowerRight)
            .GetPressedShortlyTrigger()
            .Attach(light.GetSetStateAction(couchOnlyStateId));

            room.GetButton(Office.ButtonLowerLeft)
            .GetPressedShortlyTrigger()
            .Attach(light.GetSetStateAction(deskOnlyStateId));

            room.GetButton(Office.ButtonUpperLeft)
            .GetPressedShortlyTrigger()
            .Attach(light.GetSetStateAction(BinaryStateId.On));

            _synonymService.AddSynonymsForArea(Room.Office, "Büro", "Arbeitszimmer");

            _synonymService.AddSynonymsForComponent(Room.Office, Office.CombinedCeilingLights, "Licht");
            _synonymService.AddSynonymsForComponent(Room.Office, Office.SocketRearLeftEdge, "Rotlicht", "Pufflicht", "Rot");

            _synonymService.AddSynonymsForComponentState(deskOnlyStateId, "Schreibtisch");
            _synonymService.AddSynonymsForComponentState(couchOnlyStateId, "Couch");
        }
コード例 #56
0
        private void btnCompute_Click(object sender, EventArgs e)
        {
            ProgressDialog pd = null;

            try
            {
                ItemClass item = this.comboBox1.SelectedItem as ItemClass;
                if (item == null)
                {
                    MessageBox.Show("请先选择要计算的图层", "提示");
                    return;
                }
                ItemClass fd_item = this.comboBox2.SelectedItem as ItemClass;
                if (fd_item == null)
                {
                    MessageBox.Show("请先选择要计算的字段", "提示");
                    return;
                }
                ILayer        layer     = item.Value as ILayer;
                IFeatureLayer featLayer = layer as IFeatureLayer;
                IFeatureClass fc        = featLayer.FeatureClass;
                //
                string fdName = fd_item.Caption;
                //
                int fCount = fc.FeatureCount(null);
                if (fCount > 0)
                {
                    IFeatureCursor pcursor = fc.Update(null, false);
                    IFeature       pf      = pcursor.NextFeature();
                    int            index   = fc.FindField(fdName);
                    pd         = new ProgressDialog();
                    pd.Text    = "进度";
                    pd.Message = "计算字段图形面积中......";
                    pd.Minimum = 0;
                    pd.Maximum = fCount;
                    pd.Show(this);
                    //
                    Application.DoEvents();
                    double t_area = 0.0;
                    int    n      = 0;
                    while (pf != null)
                    {
                        n = n + 1;
                        if (n % 200 == 0)
                        {
                            pd.Value   = n;
                            pd.Message = "计算字段图形面积中......" + pd.Value.ToString() + "/" + pd.Maximum.ToString();
                            Application.DoEvents();
                            pcursor.Flush();
                        }
                        IArea area = (pf.Shape as IArea);
                        if (area != null)
                        {
                            t_area = area.Area;
                            pf.set_Value(index, t_area);
                            //
                            pcursor.UpdateFeature(pf);
                        }
                        //
                        pf = pcursor.NextFeature();
                    }
                    pcursor.Flush();
                    if (pcursor != null)
                    {
                        TokayWorkspace.ComRelease(pcursor);
                        pcursor = null;
                    }
                    if (pd != null)
                    {
                        pd.Dispose();
                        pd = null;
                    }
                    MessageBox.Show("计算完毕!", "提示");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.StackTrace, "提示");
            }
            finally
            {
                if (pd != null)
                {
                    pd.Dispose();
                    pd = null;
                }
            }
        }
コード例 #57
0
        /// <summary>
        /// Called when [click].
        /// </summary>
        protected override void OnClick()
        {
            Trace.WriteLine("OpenGoogleStreetView_OnClick");

            ArcMap.Application.CurrentTool = null;
            IMap map = ArcMap.Document.FocusMap;

            try
            {
                IMxDocument doc = ArcMap.Document;

                if (doc.FocusMap.SpatialReference != null || doc.FocusMap.SpatialReference is IUnknownCoordinateSystem)
                {
                    ISpatialReference spatialrefWGS84 = this.WGS84SpatialReference();
                    ISpatialReference spatialrefMap   = doc.FocusMap.SpatialReference;

                    IEnvelope env = doc.ActiveView.Extent;

                    IPoint pt;

                    double metersPerUnit = 1;

                    if (spatialrefMap is IProjectedCoordinateSystem)
                    {
                        IProjectedCoordinateSystem pcs = (IProjectedCoordinateSystem)spatialrefMap;
                        metersPerUnit = pcs.CoordinateUnit.MetersPerUnit;
                    }

                    spatialrefWGS84.SetFalseOriginAndUnits(-180, -90, 1000000);

                    env.Project(spatialrefWGS84);

                    IArea extentArea = (IArea)env;

                    pt = extentArea.Centroid;

                    QueryStringBuilder querystring = new QueryStringBuilder();

                    querystring.MapCenterLatitude  = pt.Y;
                    querystring.MapCenterLongitude = pt.X;

                    QueryStringBuilder.StreetViewParameter streetviewParameter = new QueryStringBuilder.StreetViewParameter(pt.Y, pt.X);

                    querystring.StreetView = streetviewParameter;

                    string url = querystring.ToString();

                    Trace.WriteLine("url=" + url);

                    Process.Start(url);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show(
                        "A data frame spatial reference must be specified in order to use this tool.",
                        "Umbriel Google Street View",
                        System.Windows.Forms.MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace);

                System.Windows.Forms.MessageBox.Show(
                    "GoogleStreetView Command Error: " + ex.Message + "\n\n" + ex.StackTrace,
                    "Umbriel.GoogleStreetView",
                    System.Windows.Forms.MessageBoxButtons.OK);
            }
        }
コード例 #58
0
        /// <summary>
        /// 设置属性表中的字段值
        /// </summary>
        /// <param name="map">IMap对象</param>
        /// <param name="layerName">图层名称</param>
        /// <param name="fieldName">字段名</param>
        /// <param name="value">字段值</param>
        /// <param name="checkArea">是否检查小面积</param>
        /// <param name="area">小面积阈值,如果<b>checkArea</b>设置为false,则此值无效</param>
        public static void setValue(IMap map, string layerName, string fieldName1, object value1, string fieldName2, object value2, double area = -1)
        {
            IFeatureCursor pCursor  = Utils.getSelectFeatures(map, layerName);
            IFeature       pFeature = pCursor.NextFeature();

            if (pFeature == null)
            {
                return;
            }
            int pIndex1 = -1, pIndex2 = -1;

            try
            {
                //找字段
                pIndex1 = pFeature.Fields.FindFieldByAliasName(fieldName1);
                pIndex2 = pFeature.Fields.FindFieldByAliasName(fieldName2);
                //MessageBox.Show(pIndex1 + "---" + pIndex2);
            }
            catch (Exception)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("字段[");
                if (pIndex1 == -1)
                {
                    sb.Append(fieldName1);
                    sb.Append("]");
                    if (pIndex2 == -1)
                    {
                        sb.Append("及[");
                        sb.Append(fieldName2);
                        sb.Append("]");
                    }
                }
                else if (pIndex2 == -1)
                {
                    sb.Append(fieldName2);
                    sb.Append("]");
                }
                sb.Append("未找到");
                MessageBox.Show(sb.ToString());
            }
            if (pIndex1 >= 0 && pIndex2 >= 0)
            {
                while (pFeature != null)
                {
                    IArea pArea = pFeature.Shape as IArea;
                    if (area == -1 || pArea.Area >= area)
                    {
                        //设置属性表中的值
                        pFeature.Value[pIndex1] = value1;
                        pFeature.Value[pIndex2] = value2;
                        pFeature.Store();
                    }
                    else
                    {
                        ShowDialogWarning("当前图斑面积为:" + pArea.Area + "m²,小于临界面积:" + area + "m²。");
                    }
                    pFeature = pCursor.NextFeature();
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("字段[");
                if (pIndex1 == -1)
                {
                    sb.Append(fieldName1);
                    sb.Append("]");
                    if (pIndex2 == -1)
                    {
                        sb.Append("及[");
                        sb.Append(fieldName2);
                        sb.Append("]");
                    }
                }
                else if (pIndex2 == -1)
                {
                    sb.Append(fieldName2);
                    sb.Append("]");
                }
                sb.Append("未找到");
                MessageBox.Show(sb.ToString());
            }
        }
コード例 #59
0
        private void DrawToPictureBox(ISymbol pSym, PictureBox pBox)
        {
            IGeometry pGeometry = null;
            IntPtr    hDC;
            IEnvelope pEnvelope;

            pEnvelope = new EnvelopeClass();
            // Reset the PictureBox
            pBox.CreateGraphics().Clear(pBox.BackColor);
            try
            {
                if (pSym is IMarkerSymbol)
                {
                    pEnvelope.PutCoords(pBox.Width / 2, pBox.Height / 2, pBox.Width / 2, pBox.Height / 2);
                    IArea pArea = pEnvelope as IArea;
                    pGeometry = pArea.Centroid;
                }
                else if (pSym is ILineSymbol)
                {
                    pEnvelope.PutCoords(0, pBox.Height / 2, pBox.Width, pBox.Height / 2);
                    IPolyline pPolyline = new PolylineClass();
                    pPolyline.FromPoint = pEnvelope.LowerLeft;
                    pPolyline.ToPoint   = pEnvelope.UpperRight;
                    pGeometry           = pPolyline;
                }
                else if (pSym is IFillSymbol)
                {
                    if (pSym is SimpleFillSymbol)
                    {
                        pEnvelope.PutCoords(5, 5, pBox.Width - 5, pBox.Height - 5);
                        pGeometry = pEnvelope;
                    }
                    else if (pSym is MultiLayerFillSymbol)
                    {
                        IMultiLayerFillSymbol pMultiLayerFillSymbol = pSym as IMultiLayerFillSymbol;
                        //For mLayers As Integer = 0 To pMultiLayerFillSymbol.LayerCount - 1
                        if (pMultiLayerFillSymbol.get_Layer(0) is PictureFillSymbol)
                        {
                            IPictureFillSymbol pPictureFillSymbol = pMultiLayerFillSymbol.get_Layer(0) as IPictureFillSymbol;
                            Bitmap             m = Bitmap.FromHbitmap(new IntPtr(pPictureFillSymbol.Picture.Handle));
                            //m.MakeTransparent(System.Drawing.ColorTranslator.FromOle(pPictureFillSymbol.Color.RGB))
                            pBox.Image = m;
                            return;
                        }
                        else if (pMultiLayerFillSymbol.get_Layer(0) is SimpleFillSymbol)
                        {
                            pEnvelope.PutCoords(5, 5, pBox.Width - 5, pBox.Height - 5);
                            pGeometry = pEnvelope;
                        }
                        else if (pMultiLayerFillSymbol.get_Layer(0) is GradientFillSymbol)
                        {
                            IGradientFillSymbol      pGradientFillSymbol = pMultiLayerFillSymbol.get_Layer(0) as IGradientFillSymbol;
                            IAlgorithmicColorRamp    pRamp   = pGradientFillSymbol.ColorRamp as IAlgorithmicColorRamp;
                            System.Drawing.Rectangle rect    = new System.Drawing.Rectangle(new System.Drawing.Point(0, 0), new System.Drawing.Size(pBox.Width, pBox.Height));
                            LinearGradientBrush      lgBrush = new LinearGradientBrush(rect,
                                                                                       System.Drawing.ColorTranslator.FromOle(pRamp.FromColor.RGB),
                                                                                       System.Drawing.ColorTranslator.FromOle(pRamp.ToColor.RGB),
                                                                                       45);
                            Graphics g = pBox.CreateGraphics();
                            g.FillRectangle(lgBrush, rect);
                            rect.Width  = rect.Width - 1;
                            rect.Height = rect.Height - 1;
                            g.DrawRectangle(new Pen(ColorTranslator.FromOle(pGradientFillSymbol.Outline.Color.RGB),
                                                    (float)pGradientFillSymbol.Outline.Width), rect);
                        }
                    }
                    else if (pSym is PictureFillSymbol)
                    {
                        IPictureFillSymbol pPictureFillSymbol = pSym as IPictureFillSymbol;
                        Bitmap             m = Bitmap.FromHbitmap(new IntPtr(pPictureFillSymbol.Picture.Handle));
                        //m.MakeTransparent(System.Drawing.ColorTranslator.FromOle(pPictureFillSymbol.Color.RGB))
                        pBox.Image = m;
                        return;
                    }
                }

                hDC = GetDC(pBox.Handle);
                pSym.SetupDC(hDC.ToInt32(), null);
                pSym.ROP2 = esriRasterOpCode.esriROPCopyPen;
                if (pGeometry != null)
                {
                    pSym.Draw(pGeometry);
                }

                pSym.ResetDC();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #60
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            #region defineNPCS
            GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Albion);

            if (npcs.Length == 0)
            {
                questGiver       = new GameNPC();
                questGiver.Model = 1960;
                questGiver.Name  = questGiverName;
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questGiver.Name + ", creating him ...");
                }
                questGiver.Realm           = eRealm.Albion;
                questGiver.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 691, 0);                            //Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 692, 0);                             //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 688, 0);                            //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0);                                 //Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 689, 0);                             //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 690, 0);                             //Slot 28
                questGiver.Inventory = template.CloseTemplate();
                questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questGiver.Size    = 55;
                questGiver.Level   = 70;
                questGiver.X       = 95510;
                questGiver.Y       = 101313;
                questGiver.Z       = 5340;
                questGiver.Heading = 3060;

                if (SAVE_INTO_DATABASE)
                {
                    questGiver.SaveIntoDatabase();
                }

                questGiver.AddToWorld();
            }
            else
            {
                questGiver = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Albion);

            if (npcs.Length == 0)
            {
                questTarget       = new GameNPC();
                questTarget.Model = 73;
                questTarget.Name  = questTargetName;
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + questTarget.Name + ", creating him ...");
                }
                questTarget.Realm           = eRealm.Albion;
                questTarget.CurrentRegionID = 27;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 665, 0);                            //Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 666, 0);                             //Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 662, 0);                            //Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0);                                 //Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 663, 0);                             //Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 664, 0);                             //Slot 28
                questTarget.Inventory = template.CloseTemplate();
                questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questTarget.Size    = 50;
                questTarget.Level   = 38;
                questTarget.X       = 94789;
                questTarget.Y       = 101439;
                questTarget.Z       = 5248;
                questTarget.Heading = 2878;

                if (SAVE_INTO_DATABASE)
                {
                    questTarget.SaveIntoDatabase();
                }

                questTarget.AddToWorld();
            }
            else
            {
                questTarget = npcs[0];
            }
            #endregion

            #region defineAreas
            targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.Position, 200));
            #endregion

            #region defineBehaviours
            QuestBuilder   builder  = QuestMgr.getBuilder(typeof(MovementAndInteraction));
            QuestBehaviour a        = null;
            string         message1 = "Welcome to " + zoneName + ", <Class>. Here you will learn the basic skills needed to defend yourself as you explore our realm and grow in power and wisdom. Now, without further delay, let's get you started on your [training].";
            string         message2 = "If you exit through the doors behind me, you will enter the courtyard. In the courtyard, you will find Master Gethin, who will be your training instructor. Go now and speak to Master Gethin.";

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestPending, typeof(MovementAndInteraction), null, (eComparator)5);
            a.AddAction(eActionType.GiveQuest, typeof(MovementAndInteraction), questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3);
            a.AddAction(eActionType.Talk, message1, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Whisper, "training", questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3);
            a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null);
            a.AddAction(eActionType.Talk, message2, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.Interact, null, questGiver);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3);
            a.AddAction(eActionType.Talk, message2, questGiver);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questGiver, -1);
            a.AddTrigger(eTriggerType.EnterArea, null, targetArea);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3);
            a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null);
            AddBehaviour(a);

            a = builder.CreateBehaviour(questTarget, -1);
            a.AddTrigger(eTriggerType.Interact, null, questTarget);
            a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 3, (eComparator)3);
            a.AddAction(eActionType.FinishQuest, typeof(MovementAndInteraction), null);
            AddBehaviour(a);
            #endregion

            questGiver.AddQuestToGive(typeof(MovementAndInteraction));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }