• Nie Znaleziono Wyników

From HTML to PostGIS

N/A
N/A
Protected

Academic year: 2021

Share "From HTML to PostGIS"

Copied!
23
0
0

Pełen tekst

(1)

From HTML to PostGIS

Michał Okulewicz

Wydział Matematyki i Nauk Informacyjnych Politechnika Warszawska

(2)

Lecture plan

1 JavaScript Canvas jQuery

GoogleMaps API

(3)

JavaScript - this lecture’s scope reminder

Purpose and syntax of JavaScript

JavaScript based web applications (DOM and Events)

Creating and changing the contents of the website

Event handler properties (element.onsth = handler ;)

Document Object Model Level 2 Events (add/removeEventListener)

Creating and changing the styles on the website

style property

using classes

Selected additional topics

Utilizing canvas

jQuery

In-context library example: GoogleMaps API

(4)

JavaScript - this lecture’s scope reminder

Purpose and syntax of JavaScript

JavaScript based web applications (DOM and Events)

Creating and changing the contents of the website

Event handler properties (element.onsth = handler ;)

Document Object Model Level 2 Events (add/removeEventListener)

Creating and changing the styles on the website

style property

using classes

Selected additional topics

Utilizing canvas

(5)

Canvas element

<canvas> is an HTML block element designed to be used by JavaScript for drawing

Without JavaScript <canvas> is utterly useless

In order to draw one needs the context object:

var context = canvas.getContext(’2d’);

(6)

Basic operations and properties

context.beginPath();

context.closePath();

context.stroke();

context.fill();

context.strokeStyle;

context.fillStyle;

context.lineWidth; Basic canvas example

(7)

Shape defining operations

context.moveTo(x,y);

context.lineTo(x,y);

context.arcTo(x1,y1,x2,y2,radius);

context.quadraticCurveTo(p1.x,p1.y,x,y);

context.bezierCurveTo(p1.x,p1.y,p2.x,p2.y,x,y);

Dummy WebPaint: a drawing example

(8)

High–level operations and transformations

context.rect(x,y,width,height);

context.drawImage(HTML image,x,y);

context.fillText(text,x,y);

context.scale(x,y);

context.rotate(angle);

Move with arrows (by Karwowski) Move with WSAD (by Okulewicz)

(9)

jQuery

jQuery is a simple JavaScript library supporting code

simplification while dealing with applying functions to multiple elements at once

...and much more

jQuery speeds up writing the code and provides universal API for all browsers

plain JavaScript code will always be faster (if properly written)

Major releases:

1.x Supports IE 6, 7 and 8 (latest - 1.12.4) 2.x Discontinued

3.x Supports current browsers

(10)

jQuery

jQuery is a simple JavaScript library supporting code

simplification while dealing with applying functions to multiple elements at once

...and much more

jQuery speeds up writing the code and provides universal API for all browsers

plain JavaScript code will always be faster (if properly written)

Major releases:

1.x Supports IE 6, 7 and 8 (latest - 1.12.4) 2.x Discontinued

(11)

jQuery

jQuery is a simple JavaScript library supporting code

simplification while dealing with applying functions to multiple elements at once

...and much more

jQuery speeds up writing the code and provides universal API for all browsers

plain JavaScript code will always be faster (if properly written)

Major releases:

1.x Supports IE 6, 7 and 8 (latest - 1.12.4) 2.x Discontinued

3.x Supports current browsers

(12)

Getting started and basic concepts

The $ operator

Shorthand for jQuery

An object with jQuery methods

A method for wrapping DOM elements with jQuery functionality

DOM loaded

$(function() {

// Handler for .ready() called.

(13)

Motivation

Slightly shorter syntax in typical tasks

Easier DOM manipulation

Animation API

AJAX API

Warning: don’t fall in love with jQuery

(14)

Style manipulation

direct styling

$(’li.c’).css(’background-color’,’green’);

vs.

document.querySelectorAll(’li.c’).forEach(function(item) { item.style.backgroundColor = ’green’;

});

classes

$(’.c’).removeClass(’c’);

vs.

document.getElementsByClassName(’c’).forEach(function(item)

(15)

Style manipulation

direct styling

$(’li.c’).css(’background-color’,’green’);

vs.

document.querySelectorAll(’li.c’).forEach(function(item) { item.style.backgroundColor = ’green’;

});

classes

$(’.c’).removeClass(’c’);

vs.

document.getElementsByClassName(’c’).forEach(function(item) {

item.classList.remove(’c’);

(16)

Style manipulation

direct styling

$(’li.c’).css(’background-color’,’green’);

vs.

document.querySelectorAll(’li.c’).forEach(function(item) { item.style.backgroundColor = ’green’;

});

classes

$(’.c’).removeClass(’c’);

vs.

document.getElementsByClassName(’c’).forEach(function(item)

(17)

Events attachment and DOM manipulation

$(’li’).click(listItemClick);

$(’p’).mousedown(mouseDownHandler);

$(’#container’).append($(’<p id="new">Lorem</p>’));

$(’#new’).mousedown(mouseDownHandler);

(18)

Events attachment and DOM manipulation

$(’li’).click(listItemClick);

$(’p’).mousedown(mouseDownHandler);

$(’#container’).append($(’<p id="new">Lorem</p>’));

$(’#new’).mousedown(mouseDownHandler);

(19)

Events attachment and DOM manipulation

$(’li’).click(listItemClick);

$(’p’).mousedown(mouseDownHandler);

$(’#container’).append($(’<p id="new">Lorem</p>’));

$(’#new’).mousedown(mouseDownHandler);

(20)

Events attachment and DOM manipulation

$(’li’).click(listItemClick);

$(’p’).mousedown(mouseDownHandler);

$(’#container’).append($(’<p id="new">Lorem</p>’));

$(’#new’).mousedown(mouseDownHandler);

(21)

Events attachment and DOM manipulation

$(’li’).click(listItemClick);

$(’p’).mousedown(mouseDownHandler);

$(’#container’).append($(’<p id="new">Lorem</p>’));

$(’#new’).mousedown(mouseDownHandler);

(22)

Animations

$(li).animate(

{marginLeft: ’+=3em’}, 2000);

(23)

And finally: some GIS example

Cytaty

Powiązane dokumenty

• Document Object Model Level 2 Events (add/removeEventListener).. • Creating and changing the styles on

• The current idea are Single Page Applications consisting of HTML/CSS layout utilized by JavaScript application with content provided from REST services in a form of JSON

• With AJAX, we are taking a bunch of dusty old technologies and stretching them well beyond their original scope – AJAX in Action, Manning, 2006. Michał

Coordinate Reference Systems and Coordinate Transformations Spatial data file formats. Standards for file formats

• Minister of Internal Affairs and Administration 20th November 2010 regulation on Cataloging data sets and services of public spatial information infrastructure

Where are those data types typically utilized (APIs, services)4. Please refer to code examples

nych. Dupréel: Esquisse d ’une philosophie des valeurs. W arszawa 1959); Philo­ sophies prem ières et philosophie regressive.. Pour une th éorie

W przypadku gospodarstw przedsiębiorców istotne znaczenie miał z kolei dochód faktycznie uzyskiwany, którego wartość wpływu była wyż- sza niż wartość wpływu