Esempio n. 1
0
        // Format the given CourseView into a bunch of course objects, and add it to the given course Layout
        public RectangleF FormatCourseToLayout(SymbolDB symbolDB, CourseView courseViewAllVariations, CourseView specificVariation, CourseLayout courseLayout,
                                               Id <CourseControl> ccSelection1, Id <CourseControl> ccSelection2, CourseLayer layerAllVariations, CourseLayer layerSpecificVariation)
        {
            this.eventDB      = courseViewAllVariations.EventDB;
            this.symbolDB     = symbolDB;
            this.courseLayout = courseLayout;
            this.courseLayerAllVariationsAndParts  = layerAllVariations;
            this.courseLayerSpecificVariation      = layerSpecificVariation;
            this.controlViewsAllVariationsAndParts = courseViewAllVariations.ControlViews;
            this.controlViewsSpecificVariation     = specificVariation.ControlViews;
            this.controlPositions = new ControlPosition[controlViewsAllVariationsAndParts.Count];
            this.courseControlIdsSpecificVariation = QueryEvent.EnumCourseControlIds(eventDB, specificVariation.CourseDesignator).ToArray();
            this.courseControlIdSelection1         = ccSelection1;
            this.courseControlIdSelection2         = ccSelection2;
            this.variationMap = QueryEvent.GetVariantCodeMapping(eventDB, courseViewAllVariations.CourseDesignator);

            SizeF totalAbstractSize = AssignControlPositions(0, controlViewsAllVariationsAndParts.Count, 0, 0);

            // Now create objects now that the positions have been created.
            courseObjRatio = 1.0F;
            appearance     = new CourseAppearance();

            for (int index = 0; index < controlViewsAllVariationsAndParts.Count; ++index)
            {
                CreateObjectsForControlView(controlViewsAllVariationsAndParts[index], controlPositions[index]);
            }

            PointF     bottomCenter = LocationFromAbstractPosition(0, 0);
            SizeF      size         = SizeFromAbstractSize(totalAbstractSize);
            RectangleF rect         = new RectangleF(bottomCenter.X - size.Width / 2, bottomCenter.Y - size.Height, size.Width, size.Height);

            rect.Inflate(widthUnit, heightUnit);
            return(rect);
        }