private ObjectRotateData CreateObjectRotateDataForPoint(IMuteMap map, ILayer layer, int featureIndex)
        {
            IFeature feature = layer.FeatureSet.Features[featureIndex];

            if (feature == null)
            {
                Clear();
                return(CurrentObject);
            }

            var point = feature.Geometry.Points.First();
            var data  = new SymbolRotateData(map, layer.Handle, featureIndex, point.X, point.Y)
            {
                OriginalRotation = feature.Rotation,
            };

            string rotationExpression = layer.FeatureSet?.Style?.Marker?.RotationExpression ?? "";

            if (feature.CategoryIndex > 0)
            {
                rotationExpression = feature.Category?.Style?.Marker?.RotationExpression ?? "";
            }
            var rotationFieldIndex = GetRotationFieldIndex(rotationExpression, layer);

            if (rotationFieldIndex > 0)
            {
                data.HasBackingRotationField = true;
                data.RotationField           = rotationFieldIndex;
                data.OriginalRotation        = feature.GetAsDouble(rotationFieldIndex);
            }

            return(data);
        }
Beispiel #2
0
        private ObjectRotateData CreateObjectRotateDataForPoint(int x, int y, IMuteMap map, ILayer layer, int featureIndex)
        {
            IFeature feature = layer.FeatureSet.Features[featureIndex];

            if (feature == null)
            {
                Clear();
                return(_currentObject);
            }

            var data = new SymbolRotateData(map, layer.Handle, featureIndex)
            {
                X = x,
                Y = y,
                OriginalRotation = feature.Rotation
            };

            string rotationExpression = layer.FeatureSet?.Style?.Marker?.RotationExpression ?? "";

            if (feature.CategoryIndex > 0)
            {
                rotationExpression = feature.Category?.Style?.Marker?.RotationExpression ?? "";
            }
            var rotationFieldIndex = GetRotationFieldIndex(rotationExpression, layer);

            if (rotationFieldIndex > 0)
            {
                data.HasBackingRotationField = true;
                data.RotationField           = rotationFieldIndex;
                data.OriginalRotation        = feature.GetAsDouble(rotationFieldIndex);
            }
            else
            {
                MessageBox.Show("This feature does not have a single field rotation expression - can not rotate symbol.");
                Clear();
                return(_currentObject);
            }

            return(data);
        }