Пример #1
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Performs the plot Isolation Object actions required based on the current context
        /// </summary>
        /// <param name="isoPlotBuilder">A GCode Builder object</param>
        /// <param name="stateMachine">the gerber plot state machine</param>
        /// <param name="errorString">the error string we return on fail</param>
        /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
        /// <returns>an enum value indicating what next action to take</returns>
        public override GerberLine.PlotActionEnum PerformPlotIsoStep1Action(IsoPlotBuilder isoPlotBuilder, GerberFileStateMachine stateMachine, ref int errorValue, ref string errorString)
        {
            // one would think that turning off the contouring would be all that was necessary. However
            // contours are complex object and sometime we have to finish off the object usually this
            // means fill the existing contour object .
            if ((stateMachine.ContourDrawingModeEnabled == true) && (stateMachine.ComplexObjectList_DCode.Count != 0))
            {
                // process the complex object by drawing in the background

                // Get the bounding box
                Rectangle boundingRect = stateMachine.GetBoundingRectangleFromComplexObjectList_DCode();
                // get a list of builderIDs in the complex object list
                List <int> builderIDList = stateMachine.GetListOfIsoPlotBuilderIDsFromComplexObjectList_DCode();
                if (builderIDList.Count > 0)
                {
                    if (stateMachine.BackgroundFillModeAccordingToPolarity == GSFillModeEnum.FillMode_BACKGROUND)
                    {
                        // Normal Dark polarity. Just fill it in with a backgroundpixel
                        isoPlotBuilder.BackgroundFillGSRegionComplex(builderIDList, builderIDList[0], boundingRect.X, boundingRect.Y, boundingRect.X + boundingRect.Width, boundingRect.Y + boundingRect.Height, -1);
                    }
                    else if (stateMachine.BackgroundFillModeAccordingToPolarity == GSFillModeEnum.FillMode_ERASE)
                    {
                        // we have reverse polarity. The object we just drew must be cleaned out and everything underneath it removed
                        isoPlotBuilder.BackgroundFillGSByBoundaryComplexVert(builderIDList, IsoPlotObject.DEFAULT_ISOPLOTOBJECT_ID, boundingRect.X, boundingRect.Y, boundingRect.X + boundingRect.Width, boundingRect.Y + boundingRect.Height, -1);
                    }
                }
            }
            // reset, we have processed the complex list
            stateMachine.ComplexObjectList_DCode = new List <GerberLine_DCode>();
            // disable contour drawing mode
            stateMachine.ContourDrawingModeEnabled = false;
            return(GerberLine.PlotActionEnum.PlotAction_Continue);
        }