/** * Determines whether two lon distances overlap * * @param lonmStart * @param lonmEnd * @param lonmMin * @param lonmMax * @return */ public static boolean isLonmOverlaps(int lonmStart, int lonmEnd, int lonmStart2, int lonmEnd2) { lonmEnd = Util.makeContinuousFromStartLonm(lonmStart, lonmEnd); lonmStart2 = Util.makeContinuousLonm(lonmStart, lonmStart2); lonmEnd2 = Util.makeContinuousFromStartLonm(lonmStart2, lonmEnd2); return lonmStart2 <= lonmEnd && lonmEnd2 > lonmStart; }
public TimeViewOvalDrawer(Context context) { DISPLAYED_POINTS_BAR_RADIUS_PX = Util.convertDpToPixel(8, context); DISPLAYED_POINTS_BAR_INNER_RADIUS_PX = Util.convertDpToPixel(6, context); gradientPaint = new Paint(); selectedRegionPaint = new Paint(); selectedRegionPaint.setStrokeWidth(Util.convertDpToPixel(2, context)); selectedRegionPaint.setColor(Color.LTGRAY); updateColorRange(); }
public static int getMaximumWidth(TextPaint textPaint, Object[] units) { int maxWidth = 0; for (Object text : units) { int width = Util.getTextLength(textPaint, text.toString()); if (width > maxWidth) maxWidth = width; } return maxWidth; }
public static double getDistSquared(double lonm1, double latm1, double lonm2, double latm2) { lonm2 = Util.makeContinuousLonm(lonm1, lonm2) - lonm1; latm2 = latm2 - latm1; return lonm2 * lonm2 + latm2 * latm2; }
public static double getDist(double lonm1, double latm1, double lonm2, double latm2) { lonm2 = Util.makeContinuousLonm(lonm1, lonm2) - lonm1; latm2 = latm2 - latm1; return Math.sqrt(lonm2 * lonm2 + latm2 * latm2); }
/** * 7 8 5 6 * * <p>3 4 1 2 _ /| / latm * * <p>lonm ------> * * <p>/|\ | time */ public static String gnuPlot3DSpaceTimeBox( int minLatm, int minLonm, int heightLatm, int widthLonm, long startTime, long endTime) { return Util.gnuPlot3DIt( minLatm, minLonm, startTime // 1 , minLatm, minLonm + widthLonm, startTime // 2 , minLatm, minLonm + widthLonm, endTime // 6 , minLatm, minLonm, endTime // 5 , minLatm, minLonm, startTime // 1 , minLatm + heightLatm, minLonm, startTime // 3 , minLatm + heightLatm, minLonm, endTime // 7 , minLatm, minLonm, endTime // 5 , minLatm, minLonm + widthLonm, endTime // 6 , minLatm + heightLatm, minLonm + widthLonm, endTime // 8 , minLatm + heightLatm, minLonm + widthLonm, startTime // 4 , minLatm, minLonm + widthLonm, startTime // 2 , minLatm + heightLatm, minLonm + widthLonm, startTime // 4 , minLatm + heightLatm, minLonm, startTime // 3 , minLatm + heightLatm, minLonm, endTime // 7 , minLatm + heightLatm, minLonm + widthLonm, endTime); // 8 }
/** * 7 8 5 6 * * <p>3 4 1 2 _ /| / latm * * <p>lonm ------> * * <p>/|\ | time */ public static String gnuPlot3DLopsidedBox( int minLatm, int minLonm, int heightLatm, int widthLonm, long startTime, long endTime, int endMinLatm, int endMinLonm) { return Util.gnuPlot3DIt( minLatm, minLonm, startTime // 1 , minLatm, minLonm + widthLonm, startTime // 2 , endMinLatm, endMinLonm + widthLonm, endTime // 6 , endMinLatm, endMinLonm, endTime // 5 , minLatm, minLonm, startTime // 1 , minLatm + heightLatm, minLonm, startTime // 3 , endMinLatm + heightLatm, endMinLonm, endTime // 7 , endMinLatm, endMinLonm, endTime // 5 , endMinLatm, endMinLonm + widthLonm, endTime // 6 , endMinLatm + heightLatm, endMinLonm + widthLonm, endTime // 8 , minLatm + heightLatm, minLonm + widthLonm, startTime // 4 , minLatm, minLonm + widthLonm, startTime // 2 , minLatm + heightLatm, minLonm + widthLonm, startTime // 4 , minLatm + heightLatm, minLonm, startTime // 3 , endMinLatm + heightLatm, endMinLonm, endTime // 7 , endMinLatm + heightLatm, endMinLonm + widthLonm, endTime); // 8 }
public static boolean isLonmOverlapsPoint(int lonmStart, int lonmEnd, int lonm) { return makeContinuousFromStartLonm(lonmStart, lonmEnd) > Util.makeContinuousFromStartLonm(lonmStart, lonm); }
public static int subtractLonm(int maxLonm, int minLonm) { return Util.makeContinuousFromStartLonm(minLonm, maxLonm) - minLonm; }
public static int getLonmMax(int l1, int l2) { int al1 = Util.makeContinuousLonm(l2, l1); return normalizeLonm(Math.max(al1, l2)); }
public static int readInt(InputStream is) throws IOException { byte[] data = new byte[4]; Util.readFully(is, data); return byteArrayToInt(data, 0); }