示例#1
0
        /** Return the Y screen coordinate of the bottom of the barline.  The
         * top is getScreenHotspot().  Even though this is private, we always
         * call this function to get the value so that invalidate() and caching
         * work properly.
         */
        private int getBottomY()
        {
            if (_bottomY.HasValue)
            {
                return(_bottomY.Value);
            }

            FinalPoint top = getScreenHotspot();

            // Get the default value.
            // Use staffStepOffsetY to get the position at the bottom of the staff.
            int result = top.y + Notehead.staffStepOffsetY(0);

            // Debug: Does not consider extendsTo, etc.
            if (_extendsTo == ExtendsTo.NEXT_STAFF)
            {
                Staff staff = getParentTimeSlice().getParentMeasureStart().getParentStaff();
                if (staff.getIndex() < staff.getParentSystem().getStaffCount() - 1)
                {
                    // This is not the last staff, so we can extend to the next
                    result =
                        staff.getParentSystem().getStaff(staff.getIndex() + 1).getScreenHotspot().y;
                }
            }

            _bottomY = result;
            return(_bottomY.Value);
        }
示例#2
0
        /** Draw this object
         */
        public override void draw(IGraphics graphics)
        {
            int multiNodeCount = getMultiNodeCount();

            if (multiNodeCount == 0)
            {
                // Only the defining Beam draws the beams for all in the multi-node group
                return;
            }

            if (multiNodeCount != 2)
            {
                // DEBUG: should handle this case
                return;
            }

            Tie        leftNode            = getMultiNode(0);
            Tie        rightNode           = getMultiNode(1);
            FinalPoint leftHotspot         = leftNode.getAnchor().getScreenHotspot();
            FinalPoint rightHotspot        = rightNode.getAnchor().getScreenHotspot();
            Staff      leftNodeParentStaff =
                leftNode.getParentTimeSlice().getParentMeasureStart().getParentStaff();

            if (leftNodeParentStaff !=
                rightNode.getParentTimeSlice().getParentMeasureStart().getParentStaff())
            {
                // The two ends of the tie are on different staves. Assume that
                //   the left end should extend to the end of the staff and that
                //   the right end should have a little continuation from the beginning
                int endX = leftNodeParentStaff.getParentSystem().getScreenHotspot().x +
                           leftNodeParentStaff.getParentSystem().getWidth() + 10;
                drawTie(graphics, leftHotspot.x + 3, leftHotspot.y, endX);
                drawTie(graphics, rightHotspot.x - 12, rightHotspot.y, rightHotspot.x - 3);
            }
            else
            {
                drawTie(graphics, leftHotspot.x + 3, leftHotspot.y, rightHotspot.x - 3);
            }
        }