LibreOffice Module basegfx (master) 1
b2dpoint.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <ostream>
23
28
29namespace basegfx
30{
31 class B2DHomMatrix;
32
42 {
43 public:
49 {}
50
61 B2DPoint(double fX, double fY)
62 : B2DTuple(fX, fY)
63 {}
64
70 explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
71 : B2DTuple(rPoint)
72 {}
73
78 : B2DTuple(rTuple)
79 {}
80
82 explicit B2DPoint(Size2D<double> const& rSize)
83 : B2DTuple(rSize.getWidth(), rSize.getHeight())
84 {}
85
89 {
90 mfX *= rPnt.mfX;
91 mfY *= rPnt.mfY;
92 return *this;
93 }
94
98 {
99 mfX *= t;
100 mfY *= t;
101 return *this;
102 }
103
108 {
109 mfX = rPoint.getX();
110 mfY = rPoint.getY();
111 return *this;
112 }
113
119 BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
120
121 static const B2DPoint& getEmptyPoint()
122 {
123 return static_cast<const B2DPoint&>( ::basegfx::B2DTuple::getEmptyTuple() );
124 }
125 };
126
127 // external operators
128
135
136 template< typename charT, typename traits >
137 inline std::basic_ostream<charT, traits> & operator <<(
138 std::basic_ostream<charT, traits> & stream, const B2DPoint& point )
139 {
140 return stream << "(" << point.getX() << "," << point.getY() << ")";
141 }
142
143} // end of namespace basegfx
144
145/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base Point class with two double values.
Definition: b2dpoint.hxx:42
B2DPoint & operator*=(const B2DPoint &rPnt)
*=operator to allow usage from B2DPoint, too
Definition: b2dpoint.hxx:88
B2DPoint(const ::basegfx::B2IPoint &rPoint)
Create a copy of a 2D Point.
Definition: b2dpoint.hxx:70
B2DPoint & operator*=(double t)
*=operator to allow usage from B2DPoint, too
Definition: b2dpoint.hxx:97
B2DPoint(Tuple2D< double > const &rTuple)
constructor with tuple to allow copy-constructing from B2DTuple-based classes
Definition: b2dpoint.hxx:77
BASEGFX_DLLPUBLIC B2DPoint & operator=(Tuple2D< double > &rPoint)
assignment operator to allow assigning the results of B2DTuple calculations
Definition: b2dpoint.hxx:107
B2DPoint(double fX, double fY)
Create a 2D Point.
Definition: b2dpoint.hxx:61
B2DPoint(Size2D< double > const &rSize)
create a point from a size object
Definition: b2dpoint.hxx:82
static const B2DPoint & getEmptyPoint()
Definition: b2dpoint.hxx:121
B2DPoint()
Create a 2D Point.
Definition: b2dpoint.hxx:48
Base class for all Points/Vectors with two double values.
Definition: b2dtuple.hxx:39
static BASEGFX_DLLPUBLIC const B2DTuple & getEmptyTuple()
Definition: b2dtuple.cxx:26
TYPE getX() const
Get X-Coordinate of 2D Tuple.
Definition: Tuple2D.hxx:63
TYPE getY() const
Get Y-Coordinate of 2D Tuple.
Definition: Tuple2D.hxx:66
Reference< XOutputStream > stream
def point()
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, BColor const &color)
Definition: bcolor.hxx:176
B2DPoint operator*(const ::basegfx::B2DHomMatrix &rMat, const B2DPoint &rPoint)
Definition: b2dpoint.cxx:43
double mfY
double mfX
#define SAL_WARN_UNUSED
SmFace & operator*=(SmFace &rFace, const Fraction &rFrac)