예제 #1
0
        public List<string> CreateSketch(Section section, Section symmetricSection, CampaignReport campaignReport, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints, out SortedList<int, List<SteelThicknessGaugingPoint>> pointsPerSketch)
        {
            try
            {
                if (section == null)
                {
                    throw new ArgumentNullException("section");
                }

                if (symmetricSection == null)
                {
                    throw new ArgumentNullException("symmetricSection");
                }

                if (campaignReport == null)
                {
                    throw new ArgumentNullException("campaignReport");
                }

                int index = 0;
                pointsPerSketch = new SortedList<int, List<SteelThicknessGaugingPoint>>();

                if (!section.SectionType.Name.Equals("Shell") && !section.SectionType.Name.Equals("Longitudinal") &&
                    !section.SectionType.Name.Equals("LongitudinalBulkheads") && !symmetricSection.SectionType.Name.Equals("Shell") &&
                    !symmetricSection.SectionType.Name.Equals("Longitudinal") && !symmetricSection.SectionType.Name.Equals("LongitudinalBulkheads")
                    )
                {
                    return null;
                }

                string sectionDrawerCurrentViewModeName = section.SectionDrawer.CurrentViewModeName;
                section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                Vessel vessel = section.Vessel;
                Document document = vessel.Document as Document;

                if (!this.sectionThumbnails.ContainsKey(vessel.GUID))
                {
                    this.sectionThumbnails.Add(vessel.GUID, new Dictionary<int, Bitmap>());
                }
                if (!this.sectionThumbnails[vessel.GUID].ContainsKey(section.ID))
                {
                    this.sectionThumbnails[vessel.GUID].Add(section.ID, null);
                }
                if (this.sectionThumbnails[vessel.GUID][section.ID] == null)
                {
                    CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", false);

                    section.SectionDrawer.CurrentViewModeName = "Wireframe";

                    section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
                    section.SectionDrawer.UpdateLastCamera(this.glPanel);

                    section.SectionDrawer.DrawAxis = false;
                    bool isWireframeVisible = ViewModesData.Instance.IsVisible(section.SectionDrawer.CurrentViewModeName, "Wireframe");
                    if (!isWireframeVisible)
                    {
                        ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", true, true);
                    }

                    Bitmap bitmap = section.SectionDrawer.DrawModelImmediateMode(this.glPanel);

                    if (!isWireframeVisible)
                    {
                        ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", false, true);
                    }

                    section.SectionDrawer.DrawAxis = true;

                    this.sectionThumbnails[vessel.GUID][section.ID] = bitmap;

                    section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                    CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", true);
                }

                Bitmap originalThumbnail = this.sectionThumbnails[vessel.GUID][section.ID];

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

                List<SteelThicknessGaugingPoint> sectionSteelThicknessGaugingPoints = new List<SteelThicknessGaugingPoint>();
                List<SteelThicknessGaugingPoint> symmetricSteelThicknessGaugingPoints = new List<SteelThicknessGaugingPoint>();

                foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                {
                    if (steelThicknessGaugingPoint.Section.ID == section.ID)
                    {
                        sectionSteelThicknessGaugingPoints.Add(steelThicknessGaugingPoint);
                    }
                    else if (steelThicknessGaugingPoint.Section.ID == symmetricSection.ID)
                    {
                        symmetricSteelThicknessGaugingPoints.Add(steelThicknessGaugingPoint);
                    }
                }

                if (sectionSteelThicknessGaugingPoints != null || symmetricSteelThicknessGaugingPoints != null)
                {
                    #region Old Code

                    //int numberOfSketches = 9;

                    //Point3D minPoint = section.BoundingBox.MinPoint;
                    //Point3D maxPoint = section.BoundingBox.MaxPoint;

                    //double sizeX = maxPoint.X - minPoint.X;
                    //double deltaX = Math.Ceiling(sizeX / numberOfSketches);

                    //Vector3D planeNormal = new Vector3D(1, 0, 0);

                    //for (int i = 0; i < numberOfSketches; i++)
                    //{
                    //    Point3D minPlanePoint = new Point3D(minPoint.X + (i * deltaX), minPoint.Y, minPoint.Z);
                    //    Point3D maxPlanePoint = new Point3D(minPoint.X + ((i + 1) * deltaX), minPoint.Y, minPoint.Z);
                    //    Plane minPlane = new Plane(planeNormal, minPlanePoint);
                    //    Plane maxPlane = new Plane(planeNormal, maxPlanePoint);

                    #endregion

                    SortedList<float, SteelThicknessGaugingPoint> sortedSteelThicknessGaugingPoints = new SortedList<float, SteelThicknessGaugingPoint>();

                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                    {
                        float x = steelThicknessGaugingPoint.PointGeometry.Position.X;
                        while (sortedSteelThicknessGaugingPoints.ContainsKey(x))
                        {
                            x += (float)Point3D.Epsilon;
                        }

                        sortedSteelThicknessGaugingPoints.Add(x, steelThicknessGaugingPoint);
                    }

                    float minKey = sortedSteelThicknessGaugingPoints.Keys[0];
                    float maxKey = sortedSteelThicknessGaugingPoints.Keys[sortedSteelThicknessGaugingPoints.Count - 1];

                    Point3D minPoint = sortedSteelThicknessGaugingPoints[minKey].PointGeometry.Position;
                    Point3D maxPoint = sortedSteelThicknessGaugingPoints[maxKey].PointGeometry.Position;

                    minPoint.Translate(-2 * Point3D.Epsilon, 0, 0);
                    maxPoint.Translate(2 * Point3D.Epsilon, 0, 0);

                    double defaultSketchSize = 40;
                    double sizeX = maxPoint.X - minPoint.X;

                    int numberOfSketches = (int)Math.Floor(sizeX / defaultSketchSize);

                    if (sizeX < defaultSketchSize)
                    {
                        defaultSketchSize = sizeX;
                        numberOfSketches = 1;
                    }
                    else
                    {
                        double mod = sizeX - (numberOfSketches * defaultSketchSize);
                        if (mod > (defaultSketchSize / 2))
                        {
                            numberOfSketches++;
                            defaultSketchSize -= (mod / numberOfSketches);
                        }
                        else
                        {
                            defaultSketchSize += (mod / numberOfSketches);
                        }
                    }

                    Vector3D planeNormal = new Vector3D(1, 0, 0);
                    for (int i = 0; i < numberOfSketches; i++)
                    {
                        Point3D minPlanePoint = new Point3D(minPoint.X + (i * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Point3D maxPlanePoint = new Point3D(minPoint.X + ((i + 1) * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Plane minPlane = new Plane(planeNormal, minPlanePoint);
                        Plane maxPlane = new Plane(planeNormal, maxPlanePoint);

                        List<SteelThicknessGaugingPoint> sectionGaugingPointsBySketch = (sectionSteelThicknessGaugingPoints != null) ? this.GetPointsBetweenPlanes(sectionSteelThicknessGaugingPoints, minPlane, maxPlane) : null;
                        List<SteelThicknessGaugingPoint> symmetricGaugingPointsBySketch = (symmetricSteelThicknessGaugingPoints != null) ? this.GetPointsBetweenPlanes(symmetricSteelThicknessGaugingPoints, minPlane, maxPlane) : null;

                        if ((sectionGaugingPointsBySketch == null || sectionGaugingPointsBySketch.Count == 0) &&
                            (symmetricGaugingPointsBySketch == null || symmetricGaugingPointsBySketch.Count == 0))
                        {
                            continue;
                        }

                        List<SteelThicknessGaugingPoint> gaugingPointsBySketch = new List<SteelThicknessGaugingPoint>();
                        if (sectionGaugingPointsBySketch != null && sectionGaugingPointsBySketch.Count > 0)
                        {
                            gaugingPointsBySketch.AddRange(sectionGaugingPointsBySketch);
                        }
                        if (symmetricGaugingPointsBySketch != null && symmetricGaugingPointsBySketch.Count > 0)
                        {
                            gaugingPointsBySketch.AddRange(symmetricGaugingPointsBySketch);
                        }

                        pointsPerSketch.Add(index, gaugingPointsBySketch);
                        index++;

                        #region Compute gauging points in symmetric section

                        List<SteelThicknessGaugingPoint> pointsToBeDeleted = new List<SteelThicknessGaugingPoint>();

                        if (symmetricGaugingPointsBySketch != null && symmetricGaugingPointsBySketch.Count > 0)
                        {
                            #region Clone gauging points only in SB side, to PS side to be renderized in sketch

                            #region Find center plane parallel to X and Z axis

                            BoundingBox sectionBoundingBox = new BoundingBox();
                            BoundingBox symmetricBoundingBox = new BoundingBox();

                            List<Campaign> originalCampaigns = vessel.GetOriginalCampaigns();
                            foreach (Campaign campaign in originalCampaigns)
                            {
                                IList platesInCampaign = section.GetPermanentElementsInCampaign(campaign, true, "Plate");
                                if (platesInCampaign != null && platesInCampaign.Count > 0)
                                {
                                    foreach (Plate plate in platesInCampaign)
                                    {
                                        sectionBoundingBox.Union(plate.Design.Geometry.BoundingBox);
                                    }
                                }

                                platesInCampaign = symmetricSection.GetPermanentElementsInCampaign(campaign, true, "Plate");
                                if (platesInCampaign != null && platesInCampaign.Count > 0)
                                {
                                    foreach (Plate plate in platesInCampaign)
                                    {
                                        symmetricBoundingBox.Union(plate.Design.Geometry.BoundingBox);
                                    }
                                }
                            }

                            BoundingBox boundingBox = new BoundingBox(sectionBoundingBox);
                            boundingBox.Union(symmetricBoundingBox);

                            Plane plane = new Plane(new Vector3D(0, 1, 0), boundingBox.Center);

                            #endregion

                            SortedList<int, List<SteelThicknessGaugingPoint>> sectionOrganizedGaugingPoints = this.OrganizeIACSGaugingPointsByID(sectionGaugingPointsBySketch);
                            foreach (SteelThicknessGaugingPoint symmetricGaugingPoint in symmetricGaugingPointsBySketch)
                            {
                                if (sectionOrganizedGaugingPoints.ContainsKey((int)symmetricGaugingPoint.IACSReportLocationData.ID))
                                {
                                    bool haveSymmetricPoint = false;
                                    foreach (SteelThicknessGaugingPoint symmetricOrganizedGaugingPoint in sectionOrganizedGaugingPoints[(int)symmetricGaugingPoint.IACSReportLocationData.ID])
                                    {
                                        if (symmetricOrganizedGaugingPoint.IACSReportLocationData.IsForward == symmetricGaugingPoint.IACSReportLocationData.IsForward)
                                        {
                                            haveSymmetricPoint = true;
                                            break;
                                        }
                                    }

                                    if (haveSymmetricPoint)
                                    {
                                        continue;
                                    }
                                }

                                Point3D pointPosition = new Point3D(symmetricGaugingPoint.PointGeometry.Position);
                                pointPosition = (Point3D)pointPosition.Mirror(plane);
                                Vector3D pointNormal = new Vector3D(symmetricGaugingPoint.PointGeometry.Normal * -1);

                                int geometryID, geometryPartID;
                                List<string> elementTypeNames = new List<string>();
                                elementTypeNames.Add(symmetricGaugingPoint.TargetElement.GetBaseType().Name);
                                Point3D closestPoint;
                                SectionElement sectionElement = section.PointOverDomainEntity(pointPosition, elementTypeNames, 0.01, out closestPoint, out geometryID, out geometryPartID) as SectionElement;
                                if (sectionElement == null)
                                {
                                    continue;
                                }

                                AverageSteelThicknessGaugingPoint averageSteelThicknessGaugingPoint = new AverageSteelThicknessGaugingPoint();

                                averageSteelThicknessGaugingPoint.PointGeometry.Position = pointPosition;
                                averageSteelThicknessGaugingPoint.PointGeometry.Normal = pointNormal;

                                averageSteelThicknessGaugingPoint.Section = section;
                                averageSteelThicknessGaugingPoint.Campaign = campaignReport.Campaign;
                                averageSteelThicknessGaugingPoint.CampaignReport = campaignReport;
                                averageSteelThicknessGaugingPoint.TargetElement = sectionElement as IWorkableElement;
                                averageSteelThicknessGaugingPoint.TargetElementGeometryID = geometryID;
                                averageSteelThicknessGaugingPoint.TargetElementGeometrySegmentID = geometryPartID;
                                averageSteelThicknessGaugingPoint.TargetElementPart = symmetricGaugingPoint.TargetElementPart;
                                averageSteelThicknessGaugingPoint.Active = true;

                                averageSteelThicknessGaugingPoint.IACSReportLocationData.ID = symmetricGaugingPoint.IACSReportLocationData.ID;
                                averageSteelThicknessGaugingPoint.IACSReportLocationData.SetColumnNull();
                                averageSteelThicknessGaugingPoint.IACSReportLocationData.Strake = symmetricGaugingPoint.IACSReportLocationData.Strake;
                                averageSteelThicknessGaugingPoint.IACSReportLocationData.IsForward = (bool)symmetricGaugingPoint.IACSReportLocationData.IsForward;
                                averageSteelThicknessGaugingPoint.IACSReportLocationData.IsPortSide = !(bool)symmetricGaugingPoint.IACSReportLocationData.IsPortSide;

                                //#if (DEBUG)
                                //newFrontGaugingPoint.Name = ((bool)newFrontGaugingPoint.IACSReportLocationData.IsForward) ? "F " : "B ";
                                //newFrontGaugingPoint.Name += newFrontGaugingPoint.IACSReportLocationData.ID.ToString();
                                //newFrontGaugingPoint.Name += ((bool)newFrontGaugingPoint.IACSReportLocationData.IsPortSide) ? " P " : " S ";
                                //#else
                                averageSteelThicknessGaugingPoint.Name = averageSteelThicknessGaugingPoint.IACSReportLocationData.ID.ToString();
                                //#endif
                                section.AddPermanentDomainEntityToGroup(averageSteelThicknessGaugingPoint, true, false);
                                //section.Vessel.Document.DocumentStateController.BroadcastEntityCreation(this, averageSteelThicknessGaugingPoint);

                                sectionGaugingPointsBySketch.Add(averageSteelThicknessGaugingPoint);
                                pointsToBeDeleted.Add(averageSteelThicknessGaugingPoint);
                            }

                            #endregion
                        }

                        #endregion

                        #region Remove computed gauging points of collections to avoid unnecessary computations

                        int sketchPointsCount = 0;
                        Vector3D sketchNormal = new Vector3D();

                        if (sectionGaugingPointsBySketch != null)
                        {
                            foreach (SteelThicknessGaugingPoint sectionGaugingPointBySketch in sectionGaugingPointsBySketch)
                            {
                                sketchNormal += sectionGaugingPointBySketch.PointGeometry.Normal;

                                if (sectionSteelThicknessGaugingPoints.Contains(sectionGaugingPointBySketch))
                                {
                                    sectionSteelThicknessGaugingPoints.Remove(sectionGaugingPointBySketch);
                                }
                            }

                            sketchPointsCount += sectionGaugingPointsBySketch.Count;
                        }

                        if (symmetricGaugingPointsBySketch != null)
                        {
                            foreach (SteelThicknessGaugingPoint symmetricGaugingPointBySketch in symmetricGaugingPointsBySketch)
                            {
                                sketchNormal += symmetricGaugingPointBySketch.PointGeometry.Normal;

                                if (symmetricSteelThicknessGaugingPoints.Contains(symmetricGaugingPointBySketch))
                                {
                                    symmetricSteelThicknessGaugingPoints.Remove(symmetricGaugingPointBySketch);
                                }
                            }

                            sketchPointsCount += symmetricGaugingPointsBySketch.Count;
                        }

                        sketchNormal /= sketchPointsCount;
                        sketchNormal.Normalize();

                        #endregion

                        if (sectionGaugingPointsBySketch.Count > 0)
                        {
                            List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, minPlane, maxPlane, sectionGaugingPointsBySketch, sketchNormal);

                            // Generate thumbnail
                            section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
                            section.SectionDrawer.UpdateLastCamera(this.glPanel);

                            Bitmap thumbnail = new Bitmap(originalThumbnail, originalThumbnail.Width, originalThumbnail.Height);

                            Rectangle rectangle = this.GetRectangleOfRenderizedArea(sectionElements);
                            for (int j = 0; j < thumbnail.Width; j++)
                            {
                                for (int k = 0; k < thumbnail.Height; k++)
                                {
                                    if (this.IsPixelOfRectangle(j, k, rectangle, 3))
                                    {
                                        thumbnail.SetPixel(j, k, Color.Red);
                                    }
                                }
                            }

                            string thumbName = thumbnail.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                            this.bitmapCount++;

                            thumbName = document.HDF5DataAccessController.SaveBitmap(thumbnail, thumbName);
                            bitmaps.Add(thumbName);

                            C4DView view = section.SectionDrawer.ComputeViewForSectionElements(this.glPanel, sectionElements, false, 1.2f, true);
                            if (view == null)
                            {
                                view = section.GetDefaultView();
                            }

                            section.SectionDrawer.ConfigureView(this.glPanel, view, false);
                            section.SectionDrawer.UpdateLastCamera(this.glPanel);

                            List<int> gaugingPointIDs = new List<int>();
                            foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in sectionGaugingPointsBySketch)
                            {
                                gaugingPointIDs.Add(steelThicknessGaugingPoint.ID);
                            }

                            section.SectionDrawer.SetPriorityVisibleElements("SteelThicknessGaugingPoint", gaugingPointIDs);

                            Bitmap bitmap = section.SectionDrawer.DrawModelImmediateModeCuttingOfCompartment(this.glPanel);

                            section.SectionDrawer.ClearPriorityVisibleElements("SteelThicknessGaugingPoint");

                            string bitmapName = bitmap.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                            this.bitmapCount++;

                            bitmapName = document.HDF5DataAccessController.SaveBitmap(bitmap, bitmapName);
                            bitmaps.Add(bitmapName);

                            bitmap.Dispose();
                        }

                        foreach (SteelThicknessGaugingPoint pointToBeDeleted in pointsToBeDeleted)
                        {
                            document.DeleteSectionElement(pointToBeDeleted, false);
                        }
                    }
                }

                section.SectionDrawer.CurrentViewModeName = sectionDrawerCurrentViewModeName;

                return bitmaps;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Sketch for section/campaign report cannot be created!", ex);
            }
        }
예제 #2
0
        public List<string> CreateSketch(Section section, CampaignReport campaignReport, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints, out SortedList<int, List<SteelThicknessGaugingPoint>> pointsPerSketch)
        {
            try
            {
                if (section == null)
                {
                    throw new ArgumentNullException("section");
                }

                if (campaignReport == null)
                {
                    throw new ArgumentNullException("campaignReport");
                }

                int index = 0;
                pointsPerSketch = new SortedList<int, List<SteelThicknessGaugingPoint>>();

                SortedList<string, IList> elementsInCampaign = section.GetPermanentElementsInCampaignReport(campaignReport);
                if (!elementsInCampaign.ContainsKey("SteelThicknessGaugingPoint") || elementsInCampaign["SteelThicknessGaugingPoint"].Count == 0)
                {
                    return null;
                }

                Document document = campaignReport.Vessel.Document as Document;
                Vessel vessel = document.Vessel;

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

                string sectionDrawerCurrentViewModeName = section.SectionDrawer.CurrentViewModeName;
                section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                if (!this.sectionThumbnails.ContainsKey(vessel.GUID))
                {
                    this.sectionThumbnails.Add(vessel.GUID, new Dictionary<int, Bitmap>());
                }
                if (!this.sectionThumbnails[vessel.GUID].ContainsKey(section.ID))
                {
                    this.sectionThumbnails[vessel.GUID].Add(section.ID, null);
                }
                if (this.sectionThumbnails[vessel.GUID][section.ID] == null)
                {
                    CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", false);

                    section.SectionDrawer.CurrentViewModeName = "Wireframe";

                    section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
                    section.SectionDrawer.UpdateLastCamera(this.glPanel);

                    section.SectionDrawer.DrawAxis = false;
                    bool isWireframeVisible = ViewModesData.Instance.IsVisible(section.SectionDrawer.CurrentViewModeName, "Wireframe");
                    if (!isWireframeVisible)
                    {
                        ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", true, true);
                    }

                    Bitmap bitmap = section.SectionDrawer.DrawModelImmediateMode(this.glPanel);

                    if (!isWireframeVisible)
                    {
                        ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", false, true);
                    }
                    section.SectionDrawer.DrawAxis = true;

                    this.sectionThumbnails[vessel.GUID][section.ID] = bitmap;

                    section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                    CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", true);
                }

                Bitmap originalThumbnail = this.sectionThumbnails[vessel.GUID][section.ID];

                if (section.SectionType.Name.Equals("WebFrames") ||
                    section.SectionType.Name.Equals("TransverseBulkheads") ||
                    section.SectionType.Name.Equals("TransverseCentralBulkheads") ||
                    section.SectionType.Name.Equals("SwashBulkheads")
                   )
                {
                    #region Non Longitudinal

                    pointsPerSketch.Add(index, steelThicknessGaugingPoints);
                    index++;

                    BoundingBox boundingBox = section.GetBoundingBoxOfElementType("Plate");

                    Vector3D planeNormal = section.Normal * section.Up;
                    Point3D planePoint = boundingBox.Center;
                    Plane plane = new Plane(planeNormal, planePoint);

                    List<SteelThicknessGaugingPoint> backGaugingPoints = null;
                    List<SteelThicknessGaugingPoint> frontGaugingPoints = null;

                    this.averageGaugingsCreator.SeparateGaugingPoints(steelThicknessGaugingPoints, plane, out backGaugingPoints, out frontGaugingPoints);

                    SortedList<int, List<SteelThicknessGaugingPoint>> backOrganizedGaugingPoints = this.OrganizeIACSGaugingPointsByID(backGaugingPoints);
                    SortedList<int, List<SteelThicknessGaugingPoint>> frontOrganizedGaugingPoints = this.OrganizeIACSGaugingPointsByID(frontGaugingPoints);

                    #region Clone gauging points that only exists in source side, and copy to target side

                    List<SteelThicknessGaugingPoint> pointsToBeDeleted = new List<SteelThicknessGaugingPoint>();

                    List<SteelThicknessGaugingPoint> sourceGaugingPoints = (backGaugingPoints.Count < frontGaugingPoints.Count) ? backGaugingPoints : frontGaugingPoints;
                    List<SteelThicknessGaugingPoint> targetGaugingPoints = (backGaugingPoints.Count < frontGaugingPoints.Count) ? frontGaugingPoints : backGaugingPoints;

                    List<int> sourceGaugingPointsIACSID = (backGaugingPoints.Count < frontGaugingPoints.Count) ? new List<int>(backOrganizedGaugingPoints.Keys) : new List<int>(frontOrganizedGaugingPoints.Keys);
                    List<int> targetGaugingPointsIACSID = (backGaugingPoints.Count < frontGaugingPoints.Count) ? new List<int>(frontOrganizedGaugingPoints.Keys) : new List<int>(backOrganizedGaugingPoints.Keys);

                    foreach (SteelThicknessGaugingPoint sourceGaugingPoint in sourceGaugingPoints)
                    {
                        if (targetGaugingPointsIACSID.Contains((int)sourceGaugingPoint.IACSReportLocationData.ID))
                        {
                            continue;
                        }

                        Point3D pointPosition = new Point3D(sourceGaugingPoint.PointGeometry.Position);
                        pointPosition = (Point3D)pointPosition.Mirror(plane);
                        Vector3D pointNormal = new Vector3D(sourceGaugingPoint.PointGeometry.Normal);

                        int geometryID, geometryPartID;
                        List<string> elementTypeNames = new List<string>();
                        elementTypeNames.Add(sourceGaugingPoint.TargetElement.GetBaseType().Name);
                        Point3D closestPoint;
                        SectionElement sectionElement = section.PointOverDomainEntity(pointPosition, elementTypeNames, 0.01, out closestPoint, out geometryID, out geometryPartID) as SectionElement;
                        if (sectionElement == null)
                        {
                            continue;
                        }

                        AverageSteelThicknessGaugingPoint averageSteelThicknessGaugingPoint = new AverageSteelThicknessGaugingPoint();

                        averageSteelThicknessGaugingPoint.PointGeometry.Position = pointPosition;
                        averageSteelThicknessGaugingPoint.PointGeometry.Normal = pointNormal;

                        averageSteelThicknessGaugingPoint.Section = section;
                        averageSteelThicknessGaugingPoint.Campaign = campaignReport.Campaign;
                        averageSteelThicknessGaugingPoint.CampaignReport = campaignReport;
                        averageSteelThicknessGaugingPoint.TargetElement = sectionElement as IWorkableElement;
                        averageSteelThicknessGaugingPoint.TargetElementGeometryID = geometryID;
                        averageSteelThicknessGaugingPoint.TargetElementGeometrySegmentID = geometryPartID;
                        averageSteelThicknessGaugingPoint.TargetElementPart = sourceGaugingPoint.TargetElementPart;
                        averageSteelThicknessGaugingPoint.Active = true;
                        averageSteelThicknessGaugingPoint.GaugingValue = sourceGaugingPoint.GaugingValue;

                        averageSteelThicknessGaugingPoint.IACSReportLocationData.ID = sourceGaugingPoint.IACSReportLocationData.ID;
                        averageSteelThicknessGaugingPoint.IACSReportLocationData.SetColumnNull();
                        averageSteelThicknessGaugingPoint.IACSReportLocationData.Strake = sourceGaugingPoint.IACSReportLocationData.Strake;
                        averageSteelThicknessGaugingPoint.IACSReportLocationData.IsPortSide = !(bool)sourceGaugingPoint.IACSReportLocationData.IsPortSide;

                        averageSteelThicknessGaugingPoint.Name = averageSteelThicknessGaugingPoint.IACSReportLocationData.ID.ToString();

                        //#if (DEBUG)
                        //                        newFrontGaugingPoint.Name += ((bool)newFrontGaugingPoint.IACSReportLocationData.IsPortSide) ? " P " : " S ";
                        //#endif

                        section.AddPermanentDomainEntityToGroup(averageSteelThicknessGaugingPoint, true, false);
                        //section.Vessel.Document.DocumentStateController.BroadcastEntityCreation(this, averageSteelThicknessGaugingPoint);

                        targetGaugingPoints.Add(averageSteelThicknessGaugingPoint);
                        pointsToBeDeleted.Add(averageSteelThicknessGaugingPoint);
                    }

                    #endregion

                    List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, targetGaugingPoints);

                    // Generate thumbnail
                    Bitmap thumbnail = originalThumbnail.Clone() as Bitmap;

                    Rectangle rectangle = this.GetRectangleOfRenderizedArea(sectionElements);
                    for (int i = 0; i < thumbnail.Width; i++)
                    {
                        for (int j = 0; j < thumbnail.Height; j++)
                        {
                            if (this.IsPixelOfRectangle(i, j, rectangle, 3))
                            {
                                thumbnail.SetPixel(i, j, Color.Red);
                            }
                        }
                    }

                    //int newWidht = (int)(thumbnail.Width / 5);
                    //int newHeight = (int)(thumbnail.Height / 5);
                    //Image image = thumbnail.GetThumbnailImage(newWidht, newHeight, null, IntPtr.Zero);
                    //thumbnail = new Bitmap(image);

                    string thumbName = thumbnail.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                    this.bitmapCount++;

                    thumbName = document.HDF5DataAccessController.SaveBitmap(thumbnail, thumbName);
                    bitmaps.Add(thumbName);

                    //section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                    C4DView view = section.SectionDrawer.ComputeViewForSectionElements(this.glPanel, sectionElements, false, 1.2f, true);
                    if (view == null)
                    {
                        view = section.GetDefaultView();
                    }

                    section.SectionDrawer.ConfigureView(this.glPanel, view, false);
                    section.SectionDrawer.UpdateLastCamera(this.glPanel);

                    // Get IDs of gauging points to set in SectionDrawer
                    List<int> pointIDs = new List<int>();
                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in targetGaugingPoints)
                    {
                        pointIDs.Add(steelThicknessGaugingPoint.ID);
                    }

                    section.SectionDrawer.SetPriorityVisibleElements("SteelThicknessGaugingPoint", pointIDs);

                    Bitmap bitmap = section.SectionDrawer.DrawModelImmediateModeCuttingOfCompartment(this.glPanel);

                    section.SectionDrawer.ClearPriorityVisibleElements("SteelThicknessGaugingPoint");

                    string bitmapName = bitmap.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                    this.bitmapCount++;

                    bitmapName = document.HDF5DataAccessController.SaveBitmap(bitmap, bitmapName);
                    bitmaps.Add(bitmapName);

                    bitmap.Dispose();

                    foreach (SteelThicknessGaugingPoint pointToBeDeleted in pointsToBeDeleted)
                    {
                        document.DeleteSectionElement(pointToBeDeleted, false);
                    }

                    #endregion
                }
                else if (section.SectionType.Name.Equals("MainDeck") ||
                  section.SectionType.Name.Equals("OtherDecks") ||
                  section.SectionType.Name.Equals("InnerBottom") ||
                  section.SectionType.Name.Equals("Bottom")
                 )
                {
                    #region Decks and Inner Bottom

                    #region Old Code

                    //// Get plates in campaigns of construction or in campaigns of conversion
                    //SortedList<int, Plate> originalPlates = new SortedList<int, Plate>();

                    //List<Campaign> originalCampaigns = vessel.GetOriginalCampaigns();
                    //foreach (Campaign campaign in originalCampaigns)
                    //{
                    //    SortedList<string, IList> platesInCampaign = section.GetElementsInCampaign(campaign, true, "Plate");
                    //    if (platesInCampaign.ContainsKey("Plate"))
                    //    {
                    //        List<Plate> platesInCampaignList = platesInCampaign["Plate"].Cast<Plate>().ToList();
                    //        foreach (Plate plate in platesInCampaignList)
                    //        {
                    //            originalPlates.Add(plate.ID, plate);
                    //        }
                    //    }
                    //}

                    //// Get plates in center column
                    //Plane centerPlaneYZ = new Plane(new Vector3D(1, 0, 0), section.BoundingBox.Center);
                    //SortedList<int, Plate> intersectedPlatesYZ = this.IntersectPlates(originalPlates, centerPlaneYZ);

                    //// Get bounding box of plates in center column
                    //BoundingBox boundingBox = new BoundingBox();
                    //foreach (Plate plate in intersectedPlatesYZ.Values)
                    //{
                    //    boundingBox.Union(plate.Design.Geometry.BoundingBox);
                    //}

                    //Plane centerPlaneXZ = new Plane(new Vector3D(0, 1, 0), boundingBox.Center);

                    //Vector3D xAxis = new Vector3D(1, 0, 0);
                    //SortedList<double, Compartment> sortedCompartments = this.IntersectCompartments(section, centerPlaneXZ);
                    //foreach (Compartment compartment in sortedCompartments.Values)
                    //{
                    //    Plane minPlane = new Plane(xAxis, compartment.BoundingBox.MinPoint);
                    //    Plane maxPlane = new Plane(xAxis, compartment.BoundingBox.MaxPoint);
                    //    List<SteelThicknessGaugingPoint> pointsBetweenPlanes = this.GetPointsBetweenPlanes(steelThicknessGaugingPoints, minPlane, maxPlane);

                    #endregion

                    SortedList<float, SteelThicknessGaugingPoint> sortedSteelThicknessGaugingPoints = new SortedList<float, SteelThicknessGaugingPoint>();

                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                    {
                        float x = steelThicknessGaugingPoint.PointGeometry.Position.X;
                        while (sortedSteelThicknessGaugingPoints.ContainsKey(x))
                        {
                            x += (float)Point3D.Epsilon;
                        }

                        sortedSteelThicknessGaugingPoints.Add(x, steelThicknessGaugingPoint);
                    }

                    float minKey = sortedSteelThicknessGaugingPoints.Keys[0];
                    float maxKey = sortedSteelThicknessGaugingPoints.Keys[sortedSteelThicknessGaugingPoints.Count - 1];

                    Point3D minPoint = sortedSteelThicknessGaugingPoints[minKey].PointGeometry.Position;
                    Point3D maxPoint = sortedSteelThicknessGaugingPoints[maxKey].PointGeometry.Position;

                    minPoint.Translate(-2 * Point3D.Epsilon, 0, 0);
                    maxPoint.Translate(2 * Point3D.Epsilon, 0, 0);

                    double defaultSketchSize = 40;
                    double sizeX = maxPoint.X - minPoint.X;

                    int numberOfSketches = (int)Math.Floor(sizeX / defaultSketchSize);

                    if (sizeX < defaultSketchSize)
                    {
                        defaultSketchSize = sizeX;
                        numberOfSketches = 1;
                    }
                    else
                    {
                        double mod = sizeX - (numberOfSketches * defaultSketchSize);
                        if (mod > (defaultSketchSize / 2))
                        {
                            numberOfSketches++;
                            defaultSketchSize -= (mod / numberOfSketches);
                        }
                        else
                        {
                            defaultSketchSize += (mod / numberOfSketches);
                        }
                    }

                    Vector3D planeNormal = new Vector3D(1, 0, 0);
                    for (int i = 0; i < numberOfSketches; i++)
                    {
                        Point3D minPlanePoint = new Point3D(minPoint.X + (i * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Point3D maxPlanePoint = new Point3D(minPoint.X + ((i + 1) * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Plane minPlane = new Plane(planeNormal, minPlanePoint);
                        Plane maxPlane = new Plane(planeNormal, maxPlanePoint);
                        List<SteelThicknessGaugingPoint> pointsBetweenPlanes = this.GetPointsBetweenPlanes(steelThicknessGaugingPoints, minPlane, maxPlane);

                        if (pointsBetweenPlanes == null || pointsBetweenPlanes.Count == 0)
                        {
                            continue;
                        }

                        pointsPerSketch.Add(index, pointsBetweenPlanes);
                        index++;

                        foreach (SteelThicknessGaugingPoint pointBetweenPlane in pointsBetweenPlanes)
                        {
                            if (steelThicknessGaugingPoints.Contains(pointBetweenPlane))
                            {
                                steelThicknessGaugingPoints.Remove(pointBetweenPlane);
                            }
                        }

                        //List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, compartment);
                        List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, minPlane, maxPlane);

                        // Generate thumbnail
                        section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
                        section.SectionDrawer.UpdateLastCamera(this.glPanel);

                        Bitmap thumbnail = originalThumbnail.Clone() as Bitmap;

                        Rectangle rectangle = this.GetRectangleOfRenderizedArea(sectionElements);
                        for (int j = 0; j < thumbnail.Width; j++)
                        {
                            for (int k = 0; k < thumbnail.Height; k++)
                            {
                                if (this.IsPixelOfRectangle(j, k, rectangle, 3))
                                {
                                    thumbnail.SetPixel(j, k, Color.Red);
                                }
                            }
                        }

                        //int newWidht = (int)(thumbnail.Width / 5);
                        //int newHeight = (int)(thumbnail.Height / 5);
                        //Image image = thumbnail.GetThumbnailImage(newWidht, newHeight, null, IntPtr.Zero);
                        //thumbnail = new Bitmap(image);

                        string thumbName = thumbnail.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                        this.bitmapCount++;

                        thumbName = document.HDF5DataAccessController.SaveBitmap(thumbnail, thumbName);
                        bitmaps.Add(thumbName);

                        C4DView view = section.SectionDrawer.ComputeViewForSectionElements(this.glPanel, sectionElements, false, 1.2f, true);
                        if (view == null)
                        {
                            view = section.GetDefaultView();
                        }

                        section.SectionDrawer.ConfigureView(this.glPanel, view, false);
                        section.SectionDrawer.UpdateLastCamera(this.glPanel);

                        List<int> pointIDs = new List<int>();
                        foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in pointsBetweenPlanes)
                        {
                            pointIDs.Add(steelThicknessGaugingPoint.ID);
                        }

                        section.SectionDrawer.SetPriorityVisibleElements("SteelThicknessGaugingPoint", pointIDs);

                        Bitmap bitmap = section.SectionDrawer.DrawModelImmediateModeCuttingOfCompartment(this.glPanel);

                        section.SectionDrawer.ClearPriorityVisibleElements("SteelThicknessGaugingPoint");

                        string bitmapName = bitmap.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                        this.bitmapCount++;

                        bitmapName = document.HDF5DataAccessController.SaveBitmap(bitmap, bitmapName);
                        bitmaps.Add(bitmapName);

                        bitmap.Dispose();
                    }

                    #endregion
                }
                else if (section.SectionType.Name.Equals("Shell") ||
                         section.SectionType.Name.Equals("Longitudinal") ||
                         section.SectionType.Name.Equals("LongitudinalBulkheads") ||
                         section.SectionType.Name.Equals("LongitudinalCentralBulkheads")
                 )
                {
                    #region Symmetric Longitudinal

                    #region Old Code

                    //int numberOfSketches = 9;

                    //BoundingBox sectionBoundingBox = section.GetBoundingBoxOfElementType("Plate");

                    //Point3D minPoint = sectionBoundingBox.MinPoint;
                    //Point3D maxPoint = sectionBoundingBox.MaxPoint;

                    //double sizeX = maxPoint.X - minPoint.X;
                    //double deltaX = Math.Ceiling(sizeX / numberOfSketches);

                    //Vector3D planeNormal = new Vector3D(1, 0, 0);
                    //for (int i = 0; i < numberOfSketches; i++)
                    //{
                    //    Point3D minPlanePoint = new Point3D(minPoint.X + (i * deltaX), minPoint.Y, minPoint.Z);
                    //    Point3D maxPlanePoint = new Point3D(minPoint.X + ((i + 1) * deltaX), minPoint.Y, minPoint.Z);
                    //    Plane minPlane = new Plane(planeNormal, minPlanePoint);
                    //    Plane maxPlane = new Plane(planeNormal, maxPlanePoint);

                    #endregion

                    SortedList<float, SteelThicknessGaugingPoint> sortedSteelThicknessGaugingPoints = new SortedList<float, SteelThicknessGaugingPoint>();

                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                    {
                        float x = steelThicknessGaugingPoint.PointGeometry.Position.X;
                        while (sortedSteelThicknessGaugingPoints.ContainsKey(x))
                        {
                            x += (float)Point3D.Epsilon;
                        }

                        sortedSteelThicknessGaugingPoints.Add(x, steelThicknessGaugingPoint);
                    }

                    float minKey = sortedSteelThicknessGaugingPoints.Keys[0];
                    float maxKey = sortedSteelThicknessGaugingPoints.Keys[sortedSteelThicknessGaugingPoints.Count - 1];

                    Point3D minPoint = sortedSteelThicknessGaugingPoints[minKey].PointGeometry.Position;
                    Point3D maxPoint = sortedSteelThicknessGaugingPoints[maxKey].PointGeometry.Position;

                    minPoint.Translate(-2 * Point3D.Epsilon, 0, 0);
                    maxPoint.Translate(2 * Point3D.Epsilon, 0, 0);

                    double defaultSketchSize = 40;
                    double sizeX = maxPoint.X - minPoint.X;

                    int numberOfSketches = (int)Math.Floor(sizeX / defaultSketchSize);

                    if (sizeX < defaultSketchSize)
                    {
                        defaultSketchSize = sizeX;
                        numberOfSketches = 1;
                    }
                    else
                    {
                        double mod = sizeX - (numberOfSketches * defaultSketchSize);
                        if (mod > (defaultSketchSize / 2))
                        {
                            numberOfSketches++;
                            defaultSketchSize -= (mod / numberOfSketches);
                        }
                        else
                        {
                            defaultSketchSize += (mod / numberOfSketches);
                        }
                    }

                    Vector3D planeNormal = new Vector3D(1, 0, 0);
                    for (int i = 0; i < numberOfSketches; i++)
                    {
                        Point3D minPlanePoint = new Point3D(minPoint.X + (i * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Point3D maxPlanePoint = new Point3D(minPoint.X + ((i + 1) * defaultSketchSize), minPoint.Y, minPoint.Z);
                        Plane minPlane = new Plane(planeNormal, minPlanePoint);
                        Plane maxPlane = new Plane(planeNormal, maxPlanePoint);

                        List<SteelThicknessGaugingPoint> gaugingPointsBySketch = this.GetPointsBetweenPlanes(steelThicknessGaugingPoints, minPlane, maxPlane);
                        if (gaugingPointsBySketch == null || gaugingPointsBySketch.Count == 0)
                        {
                            continue;
                        }

                        pointsPerSketch.Add(index, gaugingPointsBySketch);
                        index++;

                        Vector3D sketchNormal = new Vector3D();
                        foreach (SteelThicknessGaugingPoint gaugingPointBySketch in gaugingPointsBySketch)
                        {
                            sketchNormal += gaugingPointBySketch.PointGeometry.Normal;

                            if (steelThicknessGaugingPoints.Contains(gaugingPointBySketch))
                            {
                                steelThicknessGaugingPoints.Remove(gaugingPointBySketch);
                            }
                        }
                        sketchNormal /= gaugingPointsBySketch.Count;
                        sketchNormal.Normalize();

                        List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, minPlane, maxPlane, gaugingPointsBySketch, sketchNormal);

                        // Generate thumbnail
                        section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
                        section.SectionDrawer.UpdateLastCamera(this.glPanel);

                        Bitmap thumbnail = originalThumbnail.Clone() as Bitmap;

                        Rectangle rectangle = this.GetRectangleOfRenderizedArea(sectionElements);
                        for (int j = 0; j < thumbnail.Width; j++)
                        {
                            for (int k = 0; k < thumbnail.Height; k++)
                            {
                                if (this.IsPixelOfRectangle(j, k, rectangle, 3))
                                {
                                    thumbnail.SetPixel(j, k, Color.Red);
                                }
                            }
                        }

                        string thumbName = thumbnail.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                        this.bitmapCount++;

                        thumbName = document.HDF5DataAccessController.SaveBitmap(thumbnail, thumbName);
                        bitmaps.Add(thumbName);

                        C4DView view = section.SectionDrawer.ComputeViewForSectionElements(this.glPanel, sectionElements, false, 1.2f, true);
                        if (view == null)
                        {
                            view = section.GetDefaultView();
                        }

                        section.SectionDrawer.ConfigureView(this.glPanel, view, false);
                        section.SectionDrawer.UpdateLastCamera(this.glPanel);

                        List<int> pointIDs = new List<int>();
                        foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in gaugingPointsBySketch)
                        {
                            pointIDs.Add(steelThicknessGaugingPoint.ID);
                        }

                        section.SectionDrawer.SetPriorityVisibleElements("SteelThicknessGaugingPoint", pointIDs);

                        Bitmap bitmap = section.SectionDrawer.DrawModelImmediateModeCuttingOfCompartment(this.glPanel);

                        section.SectionDrawer.ClearPriorityVisibleElements("SteelThicknessGaugingPoint");

                        string bitmapName = bitmap.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                        this.bitmapCount++;

                        bitmapName = document.HDF5DataAccessController.SaveBitmap(bitmap, bitmapName);
                        bitmaps.Add(bitmapName);

                        bitmap.Dispose();
                    }

                    #endregion
                }
                else if (section.SectionType.Name.Equals("AnyOtherSection"))
                {
                    #region Any Other Section

                    pointsPerSketch.Add(index, steelThicknessGaugingPoints);
                    index++;

                    List<SectionElement> sectionElements = this.GetSectionElementsVisibleInSketch(section, steelThicknessGaugingPoints);

                    Bitmap thumbnail = originalThumbnail.Clone() as Bitmap;

                    Rectangle rectangle = this.GetRectangleOfRenderizedArea(sectionElements);
                    for (int i = 0; i < thumbnail.Width; i++)
                    {
                        for (int j = 0; j < thumbnail.Height; j++)
                        {
                            if (this.IsPixelOfRectangle(i, j, rectangle, 3))
                            {
                                thumbnail.SetPixel(i, j, Color.Red);
                            }
                        }
                    }

                    //int newWidht = (int)(thumbnail.Width / 5);
                    //int newHeight = (int)(thumbnail.Height / 5);
                    //Image image = thumbnail.GetThumbnailImage(newWidht, newHeight, null, IntPtr.Zero);
                    //thumbnail = new Bitmap(image);

                    string thumbName = thumbnail.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                    this.bitmapCount++;

                    thumbName = document.HDF5DataAccessController.SaveBitmap(thumbnail, thumbName);
                    bitmaps.Add(thumbName);

                    //section.SectionDrawer.CurrentViewModeName = "SketchFormat";

                    C4DView view = section.SectionDrawer.ComputeViewForSectionElements(this.glPanel, sectionElements, false);
                    if (view == null)
                    {
                        view = section.GetDefaultView();
                    }

                    section.SectionDrawer.ConfigureView(this.glPanel, view, false);
                    section.SectionDrawer.UpdateLastCamera(this.glPanel);

                    // Get IDs of gauging points to set in SectionDrawer
                    List<int> pointIDs = new List<int>();
                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                    {
                        pointIDs.Add(steelThicknessGaugingPoint.ID);
                    }

                    section.SectionDrawer.SetPriorityVisibleElements("SteelThicknessGaugingPoint", pointIDs);

                    Bitmap bitmap = section.SectionDrawer.DrawModelImmediateModeCuttingOfCompartment(this.glPanel);

                    section.SectionDrawer.ClearPriorityVisibleElements("SteelThicknessGaugingPoint");

                    string bitmapName = bitmap.RawFormat.Guid.ToString() + "-" + this.bitmapCount.ToString() + ".jpg";
                    this.bitmapCount++;

                    bitmapName = document.HDF5DataAccessController.SaveBitmap(bitmap, bitmapName);
                    bitmaps.Add(bitmapName);

                    bitmap.Dispose();

                    #endregion
                }

                section.SectionDrawer.CurrentViewModeName = sectionDrawerCurrentViewModeName;

                return bitmaps;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Sketch for section/campaign report cannot be created!", ex);
            }
        }