安卓自定义控件之坐标存储类

原创 2015年11月20日 21:00:50

存储所有坐标所在坐标类(包括坐标文字,但不包括柱状图以及饼状图):


import java.io.Serializable;
import java.util.Comparator;

/**
 * Created by wangliang on 2016/7/29.
 */
public class Coordinate implements Serializable , Comparator<Coordinate> {
    private Float xCoordinate;
    private Float yCoordinate;
    private String coordinatename;

    public Coordinate(Float xCoordinate, Float yCoordinate, String coordinatename) {
        this.xCoordinate = xCoordinate;
        this.yCoordinate = yCoordinate;
        this.coordinatename = coordinatename;
    }

    public Coordinate() {
    }

    public Float getxCoordinate() {
        return xCoordinate;
    }

    public Coordinate setxCoordinate(Float xCoordinate) {
        this.xCoordinate = xCoordinate;
        return this;
    }

    public Float getyCoordinate() {
        return yCoordinate;
    }

    public Coordinate setyCoordinate(Float yCoordinate) {
        this.yCoordinate = yCoordinate;
        return this;
    }

    public String getCoordinatename() {
        return coordinatename;
    }

    public Coordinate setCoordinatename(String coordinatename) {
        this.coordinatename = coordinatename;
        return this;
    }

    @Override
    public String toString() {
        return "Coordinate{" +
                "xCoordinate=" + xCoordinate +
                ", yCoordinate=" + yCoordinate +
                ", coordinatename='" + coordinatename + '\'' +
                '}';
    }


    @Override
    public int compare(Coordinate o1, Coordinate o2) {
        return o1.xCoordinate.compareTo(o2.xCoordinate);
    }
}

存储柱状图坐标类:


import java.io.Serializable;

/**
 * Created by wangliang on 2016/7/29.
 */
public class LineCoordinate implements Serializable{
    private Float xStartCoordinate;
    private Float yStartCoordinate;
    private Float xStopCoordinate;
    private Float yStopCoordinate;
    private int color;
    private String coordinatename;

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
    }

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate, String coordinatename) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
        this.coordinatename = coordinatename;
    }

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate, int color, String coordinatename) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
        this.color = color;
        this.coordinatename = coordinatename;
    }

    public LineCoordinate() {

    }

    public int getColor() {
        return color;
    }

    public LineCoordinate setColor(int color) {
        this.color = color;
        return this;
    }

    public Float getxStartCoordinate() {
        return xStartCoordinate;
    }

    public LineCoordinate setxStartCoordinate(Float xStartCoordinate) {
        this.xStartCoordinate = xStartCoordinate;
        return this;
    }

    public Float getyStartCoordinate() {
        return yStartCoordinate;
    }

    public LineCoordinate setyStartCoordinate(Float yStartCoordinate) {
        this.yStartCoordinate = yStartCoordinate;
        return this;
    }

    public Float getxStopCoordinate() {
        return xStopCoordinate;
    }

    public LineCoordinate setxStopCoordinate(Float xStopCoordinate) {
        this.xStopCoordinate = xStopCoordinate;
        return this;
    }

    public Float getyStopCoordinate() {
        return yStopCoordinate;
    }

    public LineCoordinate setyStopCoordinate(Float yStopCoordinate) {
        this.yStopCoordinate = yStopCoordinate;
        return this;
    }

    public String getCoordinatename() {
        return coordinatename;
    }

    public LineCoordinate setCoordinatename(String coordinatename) {
        this.coordinatename = coordinatename;
        return this;
    }

    @Override
    public String toString() {
        return "LineCoordinate{" +
                "xStartCoordinate=" + xStartCoordinate +
                ", yStartCoordinate=" + yStartCoordinate +
                ", xStopCoordinate=" + xStopCoordinate +
                ", yStopCoordinate=" + yStopCoordinate +
                ", coordinatename=" + coordinatename +
                '}';
    }
}

相关文章推荐

Android学习方法-----心得

先熟用第三方的框架,为日后自己写框架打基础。为何这么说?刚工作时我们是没有能力写框架的,但鼓励大胆的尝试奋斗。用好第三方的如volley啊,xUtils,Image--loader,gson啊等成熟框...

学习android的一点体会

以下只是个人在android学习工作过程中一点点体会,算不上所谓的方法准则,其中可能还有些老生常谈,仅供参考吧。如果我们要学习的是一个应用程序,下面提到一些信息和方式对我们是有帮助的 1. An...

安卓自定义环形等待控件

  • 2015年10月12日 16:37
  • 2.94MB
  • 下载

安卓自定义控件-飘零落叶

  • 2016年01月20日 00:45
  • 6.59MB
  • 下载

安卓自定义控件(二)BitmapShader、ShapeDrawable、Shape

第一篇博客中,我已经Canvas、Paint、Shader、Xfermode这些对象做了总结,而现在这篇文章主要介绍BitmapShader位图渲染,Xfermode如何实际应用,还有形状的绘制。不过...

安卓自定义控件VIew

  • 2015年08月04日 15:41
  • 582KB
  • 下载

安卓自定义控件_下拉选择框spinnerdemo

1spinnerdemo package com.itheima.spinnerdemo; import java.util.ArrayList; import java.util.Lis...

安卓自定义控件基础代码

  • 2016年05月08日 00:25
  • 1.32MB
  • 下载

安卓自定义日历控件

  • 2013年05月24日 16:16
  • 1022KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:安卓自定义控件之坐标存储类
举报原因:
原因补充:

(最多只允许输入30个字)