refactor: move utility classes utils.math/geom

This commit is contained in:
Hannes Janetzek 2014-02-08 19:47:00 +01:00
parent 35566a2334
commit 14bc0aea74
19 changed files with 24 additions and 28 deletions

@ -1 +1 @@
Subproject commit 79fa132039562f0e71a62758d2b16fd188e30e46
Subproject commit a5423f42e85807c6506d27be17efbdf0ade8f144

View File

@ -45,7 +45,7 @@ import org.oscim.tiling.TileManager;
import org.oscim.tiling.source.ITileDataSink;
import org.oscim.tiling.source.ITileDataSource;
import org.oscim.tiling.source.ITileDataSource.QueryResult;
import org.oscim.utils.LineClipper;
import org.oscim.utils.geom.LineClipper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -34,8 +34,8 @@ import org.oscim.renderer.elements.ElementLayers;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.theme.styles.Line;
import org.oscim.utils.FastMath;
import org.oscim.utils.LineClipper;
import org.oscim.utils.async.SimpleWorker;
import org.oscim.utils.geom.LineClipper;
/** This class draws a path line in given color. */
public class PathLayer extends Layer {

View File

@ -21,12 +21,11 @@ import org.oscim.core.MapPosition;
import org.oscim.core.MercatorProjection;
import org.oscim.core.Point;
import org.oscim.core.Tile;
import org.oscim.map.Map;
import org.oscim.renderer.ElementRenderer;
import org.oscim.renderer.MapRenderer.Matrices;
import org.oscim.renderer.elements.SymbolItem;
import org.oscim.renderer.elements.SymbolLayer;
import org.oscim.utils.GeometryUtils;
import org.oscim.utils.geom.GeometryUtils;
import org.oscim.utils.pool.Inlist;
//TODO
@ -44,7 +43,6 @@ public class MarkerRenderer extends ElementRenderer {
/** increase view to show items that are partially visible */
protected int mExtents = 100;
private boolean mUpdate;
private Map mMap;
private InternalItem mItems;
private final Point mMapPoint = new Point();

View File

@ -51,7 +51,7 @@ import org.oscim.tiling.TileManager;
import org.oscim.tiling.source.ITileDataSink;
import org.oscim.tiling.source.ITileDataSource;
import org.oscim.tiling.source.ITileDataSource.QueryResult;
import org.oscim.utils.LineClipper;
import org.oscim.utils.geom.LineClipper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -21,8 +21,8 @@ import org.oscim.core.Tile;
import org.oscim.renderer.elements.TextItem;
import org.oscim.theme.styles.Text;
import org.oscim.tiling.MapTile;
import org.oscim.utils.GeometryUtils;
import org.oscim.utils.LineClipper;
import org.oscim.utils.geom.GeometryUtils;
import org.oscim.utils.geom.LineClipper;
public final class WayDecorator {

View File

@ -17,7 +17,7 @@
package org.oscim.layers.tile.vector.labeling;
import org.oscim.renderer.elements.TextItem;
import org.oscim.utils.OBB2D;
import org.oscim.utils.geom.OBB2D;
final class Label extends TextItem {
TextItem item;

View File

@ -13,7 +13,7 @@ import org.oscim.tiling.MapTile;
import org.oscim.tiling.TileRenderer;
import org.oscim.tiling.TileSet;
import org.oscim.utils.FastMath;
import org.oscim.utils.OBB2D;
import org.oscim.utils.geom.OBB2D;
public class LabelPlacement {
static final boolean dbg = false;

View File

@ -25,8 +25,8 @@ import org.oscim.core.MapElement;
import org.oscim.core.Tile;
import org.oscim.renderer.BufferObject;
import org.oscim.renderer.MapRenderer;
import org.oscim.utils.LineClipper;
import org.oscim.utils.Tessellator;
import org.oscim.utils.geom.LineClipper;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -32,7 +32,7 @@ import org.oscim.renderer.MapRenderer;
import org.oscim.renderer.MapRenderer.Matrices;
import org.oscim.theme.styles.Area;
import org.oscim.utils.FastMath;
import org.oscim.utils.Interpolation;
import org.oscim.utils.math.Interpolation;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -10,7 +10,7 @@ import org.oscim.renderer.ElementRenderer;
import org.oscim.renderer.MapRenderer.Matrices;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.theme.styles.Line;
import org.oscim.utils.math.BezierPath;
import org.oscim.utils.geom.BezierPath;
public class BezierPathLayer extends ElementRenderer {

View File

@ -30,7 +30,7 @@ import org.oscim.tiling.MapTile;
import org.oscim.tiling.source.ITileDataSink;
import org.oscim.tiling.source.ITileDataSource;
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
import org.oscim.utils.TileClipper;
import org.oscim.utils.geom.TileClipper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package org.oscim.utils.math;
package org.oscim.utils.geom;
import java.util.ArrayList;
import java.util.List;

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.utils;
package org.oscim.utils.geom;
public final class GeometryUtils {

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.utils;
package org.oscim.utils.geom;
/**
* from http://en.wikipedia.org/wiki/Cohen%E2%80%93

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.utils;
package org.oscim.utils.geom;
/**
* ported from http://www.flipcode.com/archives/2D_OBB_Intersection.shtml

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.utils;
package org.oscim.utils.geom;
import org.oscim.core.GeometryBuffer;

View File

@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2011 libgdx authors.
* Copyright 2011 Mario Zechner <badlogicgames@gmail.com>
* Copyright 2011 Nathan Sweet <nathan.sweet@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,13 +15,12 @@
* limitations under the License.
******************************************************************************/
package org.oscim.utils;
package org.oscim.utils.math;
/**
* Takes a linear value in the range of 0-1 and outputs a (usually) non-linear,
* interpolated value.
*
* @author Nathan Sweet
*/
public abstract class Interpolation {
/** @param a Alpha value between 0 and 1. */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright 2011 Mario Zechner <badlogicgames@gmail.com>
* Copyright 2011 Nathan Sweet <nathan.sweet@gmail.com>
*
*
* Licensed 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
@ -15,7 +15,7 @@
* limitations under the License.
******************************************************************************/
package org.oscim.utils;
package org.oscim.utils.math;
import java.util.Random;
@ -29,8 +29,6 @@ import java.util.Random;
public class MathUtils {
static public final float nanoToSec = 1 / 1000000000f;
// ---
static public final float PI = 3.1415927f;
public static final float PI2 = PI * 2;