001/* 002 * ============================================================================ 003 * Copyright © 2002-2025 by Thomas Thrien. 004 * All Rights Reserved. 005 * ============================================================================ 006 * Licensed to the public under the agreements of the GNU Lesser General Public 007 * License, version 3.0 (the "License"). You may obtain a copy of the License at 008 * 009 * http://www.gnu.org/licenses/lgpl.html 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 014 * License for the specific language governing permissions and limitations 015 * under the License. 016 */ 017 018package org.tquadrat.foundation.svg.internal; 019 020import static org.apiguardian.api.API.Status.INTERNAL; 021import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Class; 022import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Id; 023import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_PathLength; 024import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Style; 025import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_x1; 026import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_x2; 027import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_y1; 028import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_y2; 029import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Line; 030import static org.tquadrat.foundation.svg.type.SVGElementCategory.ANIMATION; 031import static org.tquadrat.foundation.svg.type.SVGElementCategory.DESCRIPTIVE; 032import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.ALLOWS_CHILDREN; 033import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_ATTRIBUTES; 034import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_CHILDREN; 035 036import java.util.ArrayList; 037import java.util.Collection; 038import java.util.HashSet; 039import java.util.List; 040 041import org.apiguardian.api.API; 042import org.tquadrat.foundation.annotation.ClassVersion; 043import org.tquadrat.foundation.svg.SVGLine; 044import org.tquadrat.foundation.svg.type.SVGNumber; 045 046/** 047 * The implementation of the 048 * {@link SVGLine} 049 * interface for the SVG {@code <line>} element. 050 * 051 * @extauthor Thomas Thrien - thomas.thrien@tquadrat.org 052 * @version $Id: SVGLineImpl.java 1151 2025-10-01 21:32:15Z tquadrat $ 053 * @since 0.0.5 054 * 055 * @UMLGraph.link 056 */ 057@ClassVersion( sourceVersion = "$Id: SVGLineImpl.java 1151 2025-10-01 21:32:15Z tquadrat $" ) 058@API( status = INTERNAL, since = "0.0.5" ) 059public final class SVGLineImpl extends SVGElementImpl implements SVGLine 060{ 061 /*--------------*\ 062 ====** Constructors **===================================================== 063 \*--------------*/ 064 /** 065 * Creates a new {@code SVGLineImpl} instance. 066 */ 067 public SVGLineImpl() 068 { 069 super( SVGELEMENT_Line, ALLOWS_CHILDREN, VALIDATES_ATTRIBUTES, VALIDATES_CHILDREN ); 070 071 //---* The children and attributes for the <line> element *------------ 072 final Collection<String> childElements = new HashSet<>(); 073 childElements.addAll( ANIMATION.getElements() ); 074 childElements.addAll( DESCRIPTIVE.getElements() ); 075 076 final Collection<String> attributes = new ArrayList<>(); 077 attributes.addAll( List.of( SVGATTRIBUTE_Id, 078 SVGATTRIBUTE_x1, SVGATTRIBUTE_y1, SVGATTRIBUTE_x2, SVGATTRIBUTE_y2, 079 SVGATTRIBUTE_PathLength, SVGATTRIBUTE_Class, SVGATTRIBUTE_Style ) ); 080 attributes.addAll( CORE_ATTRIBUTES ); 081 attributes.addAll( STYLE_ATTRIBUTES ); 082 attributes.addAll( CONDITIONALPROCESSING_ATTRIBUTES ); 083 attributes.addAll( GLOBALEVENT_ATTRIBUTES ); 084 attributes.addAll( GRAPHICALEVENT_ATTRIBUTES ); 085 attributes.addAll( PRESENTATION_ATTRIBUTES ); 086 087 updateRegistries( childElements, attributes ); 088 } // SVGLineImpl() 089 090 /*---------*\ 091 ====** Methods **========================================================== 092 \*---------*/ 093 /** 094 * {@inheritDoc} 095 */ 096 @Override 097 public final void setX1( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value ) 098 { 099 setAttribute( SVGATTRIBUTE_x1, value ); 100 } // setX1() 101 102 /** 103 * {@inheritDoc} 104 */ 105 @Override 106 public void setX2( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value ) 107 { 108 setAttribute( SVGATTRIBUTE_x2, value ); 109 } // setX2() 110 111 /** 112 * {@inheritDoc} 113 */ 114 @Override 115 public void setY1( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value ) 116 { 117 setAttribute( SVGATTRIBUTE_y1, value ); 118 } // setY1() 119 120 /** 121 * {@inheritDoc} 122 */ 123 @Override 124 public void setY2( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value ) 125 { 126 setAttribute( SVGATTRIBUTE_y2, value ); 127 } // setY2() 128} 129// class SVGLineImpl 130 131/* 132 * End of File 133 */