refactor: move utility classes utils.math/geom
This commit is contained in:
parent
35566a2334
commit
14bc0aea74
@ -1 +1 @@
|
|||||||
Subproject commit 79fa132039562f0e71a62758d2b16fd188e30e46
|
Subproject commit a5423f42e85807c6506d27be17efbdf0ade8f144
|
@ -45,7 +45,7 @@ import org.oscim.tiling.TileManager;
|
|||||||
import org.oscim.tiling.source.ITileDataSink;
|
import org.oscim.tiling.source.ITileDataSink;
|
||||||
import org.oscim.tiling.source.ITileDataSource;
|
import org.oscim.tiling.source.ITileDataSource;
|
||||||
import org.oscim.tiling.source.ITileDataSource.QueryResult;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ import org.oscim.renderer.elements.ElementLayers;
|
|||||||
import org.oscim.renderer.elements.LineLayer;
|
import org.oscim.renderer.elements.LineLayer;
|
||||||
import org.oscim.theme.styles.Line;
|
import org.oscim.theme.styles.Line;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.oscim.utils.LineClipper;
|
|
||||||
import org.oscim.utils.async.SimpleWorker;
|
import org.oscim.utils.async.SimpleWorker;
|
||||||
|
import org.oscim.utils.geom.LineClipper;
|
||||||
|
|
||||||
/** This class draws a path line in given color. */
|
/** This class draws a path line in given color. */
|
||||||
public class PathLayer extends Layer {
|
public class PathLayer extends Layer {
|
||||||
|
@ -21,12 +21,11 @@ import org.oscim.core.MapPosition;
|
|||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.core.Point;
|
import org.oscim.core.Point;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.map.Map;
|
|
||||||
import org.oscim.renderer.ElementRenderer;
|
import org.oscim.renderer.ElementRenderer;
|
||||||
import org.oscim.renderer.MapRenderer.Matrices;
|
import org.oscim.renderer.MapRenderer.Matrices;
|
||||||
import org.oscim.renderer.elements.SymbolItem;
|
import org.oscim.renderer.elements.SymbolItem;
|
||||||
import org.oscim.renderer.elements.SymbolLayer;
|
import org.oscim.renderer.elements.SymbolLayer;
|
||||||
import org.oscim.utils.GeometryUtils;
|
import org.oscim.utils.geom.GeometryUtils;
|
||||||
import org.oscim.utils.pool.Inlist;
|
import org.oscim.utils.pool.Inlist;
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
@ -44,7 +43,6 @@ public class MarkerRenderer extends ElementRenderer {
|
|||||||
/** increase view to show items that are partially visible */
|
/** increase view to show items that are partially visible */
|
||||||
protected int mExtents = 100;
|
protected int mExtents = 100;
|
||||||
private boolean mUpdate;
|
private boolean mUpdate;
|
||||||
private Map mMap;
|
|
||||||
private InternalItem mItems;
|
private InternalItem mItems;
|
||||||
private final Point mMapPoint = new Point();
|
private final Point mMapPoint = new Point();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import org.oscim.tiling.TileManager;
|
|||||||
import org.oscim.tiling.source.ITileDataSink;
|
import org.oscim.tiling.source.ITileDataSink;
|
||||||
import org.oscim.tiling.source.ITileDataSource;
|
import org.oscim.tiling.source.ITileDataSource;
|
||||||
import org.oscim.tiling.source.ITileDataSource.QueryResult;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ import org.oscim.core.Tile;
|
|||||||
import org.oscim.renderer.elements.TextItem;
|
import org.oscim.renderer.elements.TextItem;
|
||||||
import org.oscim.theme.styles.Text;
|
import org.oscim.theme.styles.Text;
|
||||||
import org.oscim.tiling.MapTile;
|
import org.oscim.tiling.MapTile;
|
||||||
import org.oscim.utils.GeometryUtils;
|
import org.oscim.utils.geom.GeometryUtils;
|
||||||
import org.oscim.utils.LineClipper;
|
import org.oscim.utils.geom.LineClipper;
|
||||||
|
|
||||||
public final class WayDecorator {
|
public final class WayDecorator {
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package org.oscim.layers.tile.vector.labeling;
|
package org.oscim.layers.tile.vector.labeling;
|
||||||
|
|
||||||
import org.oscim.renderer.elements.TextItem;
|
import org.oscim.renderer.elements.TextItem;
|
||||||
import org.oscim.utils.OBB2D;
|
import org.oscim.utils.geom.OBB2D;
|
||||||
|
|
||||||
final class Label extends TextItem {
|
final class Label extends TextItem {
|
||||||
TextItem item;
|
TextItem item;
|
||||||
|
@ -13,7 +13,7 @@ import org.oscim.tiling.MapTile;
|
|||||||
import org.oscim.tiling.TileRenderer;
|
import org.oscim.tiling.TileRenderer;
|
||||||
import org.oscim.tiling.TileSet;
|
import org.oscim.tiling.TileSet;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.oscim.utils.OBB2D;
|
import org.oscim.utils.geom.OBB2D;
|
||||||
|
|
||||||
public class LabelPlacement {
|
public class LabelPlacement {
|
||||||
static final boolean dbg = false;
|
static final boolean dbg = false;
|
||||||
|
@ -25,8 +25,8 @@ import org.oscim.core.MapElement;
|
|||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.renderer.BufferObject;
|
import org.oscim.renderer.BufferObject;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
import org.oscim.utils.LineClipper;
|
|
||||||
import org.oscim.utils.Tessellator;
|
import org.oscim.utils.Tessellator;
|
||||||
|
import org.oscim.utils.geom.LineClipper;
|
||||||
import org.oscim.utils.pool.Inlist;
|
import org.oscim.utils.pool.Inlist;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -32,7 +32,7 @@ import org.oscim.renderer.MapRenderer;
|
|||||||
import org.oscim.renderer.MapRenderer.Matrices;
|
import org.oscim.renderer.MapRenderer.Matrices;
|
||||||
import org.oscim.theme.styles.Area;
|
import org.oscim.theme.styles.Area;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.oscim.utils.Interpolation;
|
import org.oscim.utils.math.Interpolation;
|
||||||
import org.oscim.utils.pool.Inlist;
|
import org.oscim.utils.pool.Inlist;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -10,7 +10,7 @@ import org.oscim.renderer.ElementRenderer;
|
|||||||
import org.oscim.renderer.MapRenderer.Matrices;
|
import org.oscim.renderer.MapRenderer.Matrices;
|
||||||
import org.oscim.renderer.elements.LineLayer;
|
import org.oscim.renderer.elements.LineLayer;
|
||||||
import org.oscim.theme.styles.Line;
|
import org.oscim.theme.styles.Line;
|
||||||
import org.oscim.utils.math.BezierPath;
|
import org.oscim.utils.geom.BezierPath;
|
||||||
|
|
||||||
public class BezierPathLayer extends ElementRenderer {
|
public class BezierPathLayer extends ElementRenderer {
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import org.oscim.tiling.MapTile;
|
|||||||
import org.oscim.tiling.source.ITileDataSink;
|
import org.oscim.tiling.source.ITileDataSink;
|
||||||
import org.oscim.tiling.source.ITileDataSource;
|
import org.oscim.tiling.source.ITileDataSource;
|
||||||
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.oscim.utils.math;
|
package org.oscim.utils.geom;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.utils;
|
package org.oscim.utils.geom;
|
||||||
|
|
||||||
public final class GeometryUtils {
|
public final class GeometryUtils {
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* 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
|
* from http://en.wikipedia.org/wiki/Cohen%E2%80%93
|
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* 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
|
* ported from http://www.flipcode.com/archives/2D_OBB_Intersection.shtml
|
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.utils;
|
package org.oscim.utils.geom;
|
||||||
|
|
||||||
import org.oscim.core.GeometryBuffer;
|
import org.oscim.core.GeometryBuffer;
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,13 +15,12 @@
|
|||||||
* limitations under the License.
|
* 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,
|
* Takes a linear value in the range of 0-1 and outputs a (usually) non-linear,
|
||||||
* interpolated value.
|
* interpolated value.
|
||||||
*
|
|
||||||
* @author Nathan Sweet
|
|
||||||
*/
|
*/
|
||||||
public abstract class Interpolation {
|
public abstract class Interpolation {
|
||||||
/** @param a Alpha value between 0 and 1. */
|
/** @param a Alpha value between 0 and 1. */
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
package org.oscim.utils;
|
package org.oscim.utils.math;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -29,8 +29,6 @@ import java.util.Random;
|
|||||||
public class MathUtils {
|
public class MathUtils {
|
||||||
static public final float nanoToSec = 1 / 1000000000f;
|
static public final float nanoToSec = 1 / 1000000000f;
|
||||||
|
|
||||||
// ---
|
|
||||||
|
|
||||||
static public final float PI = 3.1415927f;
|
static public final float PI = 3.1415927f;
|
||||||
public static final float PI2 = PI * 2;
|
public static final float PI2 = PI * 2;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user