예제 #1
0
        private void GetPathGeometries(IScatterSymbol symbol, double symbolSize, out PathGeometry fill, out PathGeometry frame, out PathGeometry inset)
        {
            symbol.CalculatePolygons(null, out var framePolygon, out var insetPolygon, out var fillPolygon);

            fill  = fillPolygon == null ? null : GetPathGeometry(fillPolygon, symbolSize);
            frame = framePolygon == null ? null : GetPathGeometry(framePolygon, symbolSize);
            inset = insetPolygon == null ? null : GetPathGeometry(insetPolygon, symbolSize);
        }
예제 #2
0
        /// <summary>
        /// Calculates the paths and stores them into a structure given by the argument <paramref name="cachedPathData"/>.
        /// </summary>
        /// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
        /// <param name="symbolSize">The size of the symbol for which to calculate the paths.</param>
        /// <param name="cachedPathData">The cached path data.</param>
        /// <returns>True if new paths have been calculated; false if the previously cached data could be used.</returns>
        private bool CalculatePaths(IScatterSymbol scatterSymbol, double symbolSize, ref CachedPathData cachedPathData)
        {
            if (symbolSize == cachedPathData.SymbolSize)
            {
                return(false); // we assume that the structure already contains valid data.
            }
            cachedPathData.SymbolSize = symbolSize;
            cachedPathData.FillPath   = cachedPathData.FramePath = cachedPathData.InsetPath = null;

            if (scatterSymbol is NoSymbol)
            {
                return(true);
            }

            double?overrideRelativeStructureWidth = null;

            if (_overrideStructureWidthOffset.HasValue || _overrideStructureWidthFactor.HasValue)
            {
                overrideRelativeStructureWidth = (_overrideStructureWidthFactor ?? 0) + (_overrideStructureWidthOffset ?? 0) / symbolSize;
            }
            scatterSymbol.CalculatePolygons(overrideRelativeStructureWidth, out var framePolygon, out var insetPolygon, out var fillPolygon);

            // calculate the path only once
            if (null != insetPolygon)
            {
                cachedPathData.InsetPath = new GraphicsPath();
                foreach (var list in insetPolygon)
                {
                    cachedPathData.InsetPath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            if (null != fillPolygon)
            {
                cachedPathData.FillPath = new GraphicsPath();
                foreach (var list in fillPolygon)
                {
                    cachedPathData.FillPath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            if (null != framePolygon)
            {
                cachedPathData.FramePath = new GraphicsPath();
                foreach (var list in framePolygon)
                {
                    cachedPathData.FramePath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            return(true);
        }
예제 #3
0
		/// <summary>
		/// Calculates the paths and stores them into a structure given by the argument <paramref name="cachedPathData"/>.
		/// </summary>
		/// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
		/// <param name="symbolSize">The size of the symbol for which to calculate the paths.</param>
		/// <param name="cachedPathData">The cached path data.</param>
		/// <returns>True if new paths have been calculated; false if the previously cached data could be used.</returns>
		private bool CalculatePaths(IScatterSymbol scatterSymbol, double symbolSize, ref CachedPathData cachedPathData)
		{
			if (symbolSize == cachedPathData.SymbolSize)
				return false; // we assume that the structure already contains valid data.

			cachedPathData.SymbolSize = symbolSize;
			cachedPathData.FillPath = cachedPathData.FramePath = cachedPathData.InsetPath = null;

			if (scatterSymbol is NoSymbol)
			{
				return true;
			}

			List<List<ClipperLib.IntPoint>> insetPolygon = null;
			List<List<ClipperLib.IntPoint>> framePolygon = null;
			List<List<ClipperLib.IntPoint>> fillPolygon = null;

			double? overrideRelativeStructureWidth = null;
			if (_overrideStructureWidthOffset.HasValue || _overrideStructureWidthFactor.HasValue)
			{
				overrideRelativeStructureWidth = (_overrideStructureWidthFactor ?? 0) + (_overrideStructureWidthOffset ?? 0) / symbolSize;
			}
			scatterSymbol.CalculatePolygons(overrideRelativeStructureWidth, out framePolygon, out insetPolygon, out fillPolygon);

			// calculate the path only once
			if (null != insetPolygon)
			{
				cachedPathData.InsetPath = new GraphicsPath();
				foreach (var list in insetPolygon)
					cachedPathData.InsetPath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			if (null != fillPolygon)
			{
				cachedPathData.FillPath = new GraphicsPath();
				foreach (var list in fillPolygon)
					cachedPathData.FillPath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			if (null != framePolygon)
			{
				cachedPathData.FramePath = new GraphicsPath();
				foreach (var list in framePolygon)
					cachedPathData.FramePath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			return true;
		}
예제 #4
0
		private void GetPathGeometries(IScatterSymbol symbol, double symbolSize, out PathGeometry fill, out PathGeometry frame, out PathGeometry inset)
		{
			List<List<ClipperLib.IntPoint>> framePolygon, insetPolygon, fillPolygon;

			symbol.CalculatePolygons(null, out framePolygon, out insetPolygon, out fillPolygon);

			fill = fillPolygon == null ? null : GetPathGeometry(fillPolygon, symbolSize);
			frame = framePolygon == null ? null : GetPathGeometry(framePolygon, symbolSize);
			inset = insetPolygon == null ? null : GetPathGeometry(insetPolygon, symbolSize);
		}