-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c8f1569
Showing
43 changed files
with
6,617 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>MosaicPlanner</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.python.pydev.PyDevBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.python.pydev.pythonNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse-pydev version="1.0"?> | ||
|
||
<pydev_project> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> | ||
</pydev_project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#=============================================================================== | ||
# | ||
# License: GPL | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License 2 | ||
# as published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
# | ||
#=============================================================================== | ||
|
||
import matplotlib.patches | ||
|
||
class CenterRectangle(matplotlib.patches.Rectangle): | ||
"""a simple extension of the matplotlib Rectangle class which allows you to specify the center and width/height | ||
rather than the corner and the width/height of the rectangle""" | ||
def __init__(self,xy, width, height, **kwargs): | ||
self.xyc=xy | ||
(x,y)=xy | ||
self.l=x-width/2 | ||
self.b=y-height/2 | ||
matplotlib.patches.Rectangle.__init__(self, (self.l,self.b), width, height,**kwargs) | ||
|
||
def set_center(self,xy): | ||
"""sets a new center point tuple for the rectangle.. do not use set_x and set_y with this class | ||
as those still specify the corner""" | ||
self.xyc=xy | ||
(x,y)=xy | ||
self.set_x(x-self.get_width()/2) | ||
self.set_y(y-self.get_height()/2) | ||
def set_width(self,width): | ||
"""sets the width of this rectangle, and then recalls the setting of the center so that its center stays still""" | ||
super(type(self), self).set_width(width) | ||
self.set_center(self.xyc) | ||
def set_height(self,height): | ||
"""sets the height of this rectangle, and then recalls the set_center so that the center stays still""" | ||
super(type(self), self).set_height(height) | ||
self.set_center(self.xyc) |
Oops, something went wrong.