Giter Club home page Giter Club logo

sample-gis-datatypes-cuba's Introduction

sample-gis-datatypes

The application extends standard CUBA datatypes with geo-specific types from the opensource JTS Topology Suite:

  1. Point
  2. LineString
  3. Polygon
  4. Multi Polygon

Using JTS your CUBA application amplifies its power with Geometric functions, Spatial structures and algorithms and I/O capabilities, coming along with the topology suite. So, your application has all essential features to become a full-scale geographic information system.

screenshot

Adding a Custom Datatype

General information on datatypes is available in the corresponding section of the official platform manual. You can find implementation of geo types in this folder of the project. They are also declared in the metadata.xml file.

This project demonstrates the process of storing and reading a complex datatype such as geo objects. So, while persisting the objects are converted to the WKT format and persisted as text. While reading this text will be parsed back into the objects, so that you can work with them normally from the source code. Such behaviour is achieved by using JPA converters. The converters should also be registered in the persistence.xml file.

To apply the converters for a field it should be annotated with the @Convert(converter = SomeConverter.class) annotation. See the location field of the Port entity in the sample project as an example:

public class Port extends StandardEntity {
    
    ...
    
    @Convert(converter = CubaPointWKTConverter.class)
    @MetaProperty(datatype = PointDatatype.NAME, mandatory = true)
    @Column(name = "LOCATION", nullable = false)
    protected Point location;
    
    ...
    
    public Point getLocation() {
        return location;
    }

    public void setLocation(Point location) {
        this.location = location;
    }
    
    ...
    
}

DBMS support

  • Datatypes are not DB independent. To specify SQL type which should be used with another DBMS - add additional @Ddl annotations to the data type definitions in the com.company.cruisesample.gis.datatypes package:
@Ddl(dbms = "postgres", value = "geometry")
@Ddl(dbms = "mydbms", value = "dbms-specific SQL type")
public class PointDatatype implements Datatype<Point> {
...
}

sample-gis-datatypes-cuba's People

Contributors

aleksey-stukalov avatar alexbudarov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.