1*8b851043SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*8b851043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*8b851043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*8b851043SAndrew Rist * distributed with this work for additional information 6*8b851043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*8b851043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*8b851043SAndrew Rist * "License"); you may not use this file except in compliance 9*8b851043SAndrew Rist * with the License. You may obtain a copy of the License at 10*8b851043SAndrew Rist * 11*8b851043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*8b851043SAndrew Rist * 13*8b851043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*8b851043SAndrew Rist * software distributed under the License is distributed on an 15*8b851043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*8b851043SAndrew Rist * KIND, either express or implied. See the License for the 17*8b851043SAndrew Rist * specific language governing permissions and limitations 18*8b851043SAndrew Rist * under the License. 19*8b851043SAndrew Rist * 20*8b851043SAndrew Rist *************************************************************/ 21*8b851043SAndrew Rist 22*8b851043SAndrew Rist 23cdf0e10cSrcweir #ifndef _LINE_HXX 24cdf0e10cSrcweir #define _LINE_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "tools/toolsdllapi.h" 27cdf0e10cSrcweir #include <tools/gen.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir class Link; 30cdf0e10cSrcweir 31cdf0e10cSrcweir // -------- 32cdf0e10cSrcweir // - Line - 33cdf0e10cSrcweir // -------- 34cdf0e10cSrcweir 35cdf0e10cSrcweir class TOOLS_DLLPUBLIC Line 36cdf0e10cSrcweir { 37cdf0e10cSrcweir private: 38cdf0e10cSrcweir 39cdf0e10cSrcweir Point maStart; 40cdf0e10cSrcweir Point maEnd; 41cdf0e10cSrcweir 42cdf0e10cSrcweir public: Line()43cdf0e10cSrcweir Line() {}; Line(const Point & rStartPt,const Point & rEndPt)44cdf0e10cSrcweir Line( const Point& rStartPt, const Point& rEndPt ) : maStart( rStartPt ), maEnd( rEndPt ) {} 45cdf0e10cSrcweir SetStart(const Point & rStartPt)46cdf0e10cSrcweir void SetStart( const Point& rStartPt ) { maStart = rStartPt; } GetStart() const47cdf0e10cSrcweir const Point& GetStart() const { return maStart; } 48cdf0e10cSrcweir SetEnd(const Point & rEndPt)49cdf0e10cSrcweir void SetEnd( const Point& rEndPt ) { maEnd = rEndPt; } GetEnd() const50cdf0e10cSrcweir const Point& GetEnd() const { return maEnd; } 51cdf0e10cSrcweir Left() const52cdf0e10cSrcweir long Left() const { return ( maStart.X() < maEnd.X() ) ? maStart.X() : maEnd.X(); } Top() const53cdf0e10cSrcweir long Top() const { return ( maStart.Y() < maEnd.Y() ) ? maStart.Y() : maEnd.Y(); } Right() const54cdf0e10cSrcweir long Right() const { return ( maStart.X() > maEnd.X() ) ? maStart.X() : maEnd.X(); } Bottom() const55cdf0e10cSrcweir long Bottom() const { return ( maStart.Y() > maEnd.Y() ) ? maStart.Y() : maEnd.Y(); } 56cdf0e10cSrcweir 57cdf0e10cSrcweir double GetLength() const; 58cdf0e10cSrcweir 59cdf0e10cSrcweir sal_Bool Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const; 60cdf0e10cSrcweir sal_Bool Intersection( const Line& rLine, Point& rIntersection ) const; 61cdf0e10cSrcweir sal_Bool Intersection( const Rectangle& rRect, Line& rIntersection ) const; 62cdf0e10cSrcweir 63cdf0e10cSrcweir double GetDistance( const double& rPtX, const double& rPtY ) const; GetDistance(const Point & rPoint) const64cdf0e10cSrcweir double GetDistance( const Point& rPoint ) const { return( GetDistance( rPoint.X(), rPoint.Y() ) ); } 65cdf0e10cSrcweir 66cdf0e10cSrcweir Point NearestPoint( const Point& rPoint ) const; 67cdf0e10cSrcweir 68cdf0e10cSrcweir void Enum( const Link& rEnumLink ); 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir #endif // _SV_LINE_HXX 72