Kaydet (Commit) 7a4e7968 authored tarafından Zsolt Bölöny's avatar Zsolt Bölöny Kaydeden (comit) Noel Grandin

Remove B1IBox, it's not used anywhere

Change-Id: Ifff5fc008552f80fcbb705013c1f578f5f825b24
Reviewed-on: https://gerrit.libreoffice.org/15814Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 55bc1286
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <basegfx/range/b2ibox.hxx> #include <basegfx/range/b2ibox.hxx>
#include <basegfx/range/b1drange.hxx> #include <basegfx/range/b1drange.hxx>
#include <basegfx/range/b1irange.hxx> #include <basegfx/range/b1irange.hxx>
#include <basegfx/range/b1ibox.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2dpolyrange.hxx> #include <basegfx/range/b2dpolyrange.hxx>
#include <basegfx/numeric/ftools.hxx> #include <basegfx/numeric/ftools.hxx>
...@@ -965,64 +964,6 @@ public: ...@@ -965,64 +964,6 @@ public:
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; // class b1Xrange }; // class b1Xrange
class b1ibox : public CppUnit::TestFixture
{
public:
void TestBox()
{
// test axioms - markedly different from proper mathematical
// intervals (behaviour modelled after how polygon fill
// algorithms fill pixels)
B1IBox aBox;
CPPUNIT_ASSERT_MESSAGE("default ctor - empty range", aBox.isEmpty());
// degenerate box
aBox.expand(1);
CPPUNIT_ASSERT_MESSAGE("degenerate box - still empty!", aBox.isEmpty());
CPPUNIT_ASSERT_MESSAGE("degenerate box - size of 0", aBox.getRange() == 0);
CPPUNIT_ASSERT_MESSAGE("same value as degenerate box - is outside (since empty)", !aBox.isInside(1));
CPPUNIT_ASSERT_MESSAGE("center - get cop-out value since box is empty", aBox.getCenter()==0);
// proper box
aBox.expand(2);
CPPUNIT_ASSERT_MESSAGE("proper box - size of 1", aBox.getRange() == 1);
CPPUNIT_ASSERT_MESSAGE("smaller value of box", aBox.isInside(1));
CPPUNIT_ASSERT_MESSAGE("larger value of box - must be outside", !aBox.isInside(2));
// center for proper box that works for ints, too
aBox.expand(4);
CPPUNIT_ASSERT_MESSAGE("center - must be center pixel of the box", aBox.getCenter()==2);
// check overlap, which is markedly different from Range
B1IBox aBox2(0,1);
CPPUNIT_ASSERT_MESSAGE("box overlapping *excludes* upper bound", !aBox.overlaps(aBox2));
B1IBox aBox3(0,2);
CPPUNIT_ASSERT_MESSAGE("box overlapping then includes upper bound-1", aBox.overlaps(aBox3));
// check intersect
B1IBox aBox4(4,5);
aBox.intersect(aBox4);
CPPUNIT_ASSERT_MESSAGE("box intersection is yielding nonempty box!", aBox.isEmpty());
B1IBox aBox5(2,5);
aBox5.intersect(aBox4);
CPPUNIT_ASSERT_MESSAGE("box intersection is yielding empty box!", !aBox5.isEmpty());
// just so that this compiles -
B1IBox aBox6( aBox );
(void)aBox6;
}
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE(b1ibox);
CPPUNIT_TEST(TestBox);
CPPUNIT_TEST_SUITE_END();
}; // class b1ibox
class b2Xrange : public CppUnit::TestFixture class b2Xrange : public CppUnit::TestFixture
{ {
public: public:
...@@ -1286,7 +1227,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygon); ...@@ -1286,7 +1227,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygon);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygontools); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygontools);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolypolygon); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolypolygon);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b1Xrange); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b1Xrange);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b1ibox);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2Xrange); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2Xrange);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2ibox); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2ibox);
CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dtuple); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dtuple);
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_BASEGFX_RANGE_B1IBOX_HXX
#define INCLUDED_BASEGFX_RANGE_B1IBOX_HXX
#include <basegfx/range/basicbox.hxx>
#include <basegfx/basegfxdllapi.h>
namespace basegfx
{
/** A one-dimensional interval over integers
This is most easily depicted as a set of integers, bounded by
a lower and an upper value - but excluding the upper
value. All inbetween values are included in the set (see also
http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
The set is half-open, i.e. the lower bound is included, the
upper bound not (if you're used to the notation - we're
talking about [a,b) here, compared to closed [a,b] or fully
open intervals (a,b)).
If you don't need a half-open interval, check B1IRange.
That means, isInside(val) will return true also for values of
val=a, but not for val=b.
@see B1IRange
*/
class B1IBox
{
::basegfx::BasicBox maRange;
public:
B1IBox() {}
/// Create degenerate interval that's still empty
explicit B1IBox(sal_Int32 nStartValue)
: maRange(nStartValue)
{
}
/// Create proper interval between the two given values
B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
: maRange(nStartValue1)
{
expand(nStartValue2);
}
/** Check if the interval set is empty
@return false, if no value is in this set - having a
single value included will still return false.
*/
bool isEmpty() const
{
return maRange.isEmpty();
}
/// reset the object to empty state again, clearing all values
void reset()
{
maRange.reset();
}
bool operator==( const B1IBox& rBox ) const
{
return (maRange == rBox.maRange);
}
bool operator!=( const B1IBox& rBox ) const
{
return (maRange != rBox.maRange);
}
/// get lower bound of the set. returns arbitrary values for empty sets.
sal_Int32 getMinimum() const
{
return maRange.getMinimum();
}
/// get upper bound of the set. returns arbitrary values for empty sets.
sal_Int32 getMaximum() const
{
return maRange.getMaximum();
}
/// return difference between upper and lower value. returns 0 for empty sets.
Int32Traits::DifferenceType getRange() const
{
return maRange.getRange();
}
/// return middle of upper and lower value. returns 0 for empty sets.
double getCenter() const
{
return maRange.getCenter();
}
/// yields true if value is contained in set
bool isInside(sal_Int32 nValue) const
{
return maRange.isInside(nValue);
}
/// yields true if rRange is inside, or equal to set
bool isInside(const B1IBox& rBox) const
{
return maRange.isInside(rBox.maRange);
}
/// yields true if rRange at least partly inside set
bool overlaps(const B1IBox& rBox) const
{
return maRange.overlaps(rBox.maRange);
}
/// add nValue to the set, expanding as necessary
void expand(sal_Int32 nValue)
{
maRange.expand(nValue);
}
/// add rBox to the set, expanding as necessary
void expand(const B1IBox& rBox)
{
maRange.expand(rBox.maRange);
}
/// calc set intersection
void intersect(const B1IBox& rBox)
{
maRange.intersect(rBox.maRange);
}
/// grow set by nValue on both sides
void grow(sal_Int32 nValue)
{
maRange.grow(nValue);
}
};
} // end of namespace basegfx
#endif // INCLUDED_BASEGFX_RANGE_B1IBOX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -32,8 +32,6 @@ namespace basegfx ...@@ -32,8 +32,6 @@ namespace basegfx
value. All inbetween values are included in the set (see also value. All inbetween values are included in the set (see also
http://en.wikipedia.org/wiki/Interval_%28mathematics%29). http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
Probably you rather want B1IBox for integers.
The set is closed, i.e. the upper and the lower bound are The set is closed, i.e. the upper and the lower bound are
included (if you're used to the notation - we're talking about included (if you're used to the notation - we're talking about
[a,b] here, compared to half-open [a,b) or open intervals [a,b] here, compared to half-open [a,b) or open intervals
...@@ -41,8 +39,6 @@ namespace basegfx ...@@ -41,8 +39,6 @@ namespace basegfx
That means, isInside(val) will return true also for values of That means, isInside(val) will return true also for values of
val=a or val=b. val=a or val=b.
@see B1IBox
*/ */
class B1IRange class B1IRange
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment