Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor GL line rendering #649

Merged
merged 33 commits into from
Jan 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
484ae97
Refactor GL line rendering.
manthey Jul 19, 2016
f660570
Change the threshold for straight joins.
manthey Nov 21, 2016
30ae945
Increase the zone used with miter joints to ensure that clipping is d…
manthey Nov 21, 2016
dd8203f
Merge branch 'master' into line-rendering
manthey Nov 21, 2016
32bd75f
Sped up line creation by calling less functions.
manthey Nov 22, 2016
29e2635
Add example for lines.
manthey Nov 22, 2016
29af57e
Make the osm layer optional on the lines example.
manthey Nov 22, 2016
d07b57b
Tweaks to the example.
manthey Nov 23, 2016
f338e00
Add hover text to the lines example.
manthey Nov 28, 2016
64a345a
Speed up point search on lines.
manthey Nov 28, 2016
a656e9e
Merge branch 'master' into line-rendering
manthey Nov 28, 2016
8c7255c
Support lineCap, lineJoin, and miterLimit in svg lines.
manthey Nov 28, 2016
a05f30c
Support lines on the canvas renderer.
manthey Nov 28, 2016
f875752
Fix some issues in the d3 line renderer.
manthey Nov 28, 2016
be3c65d
Merge branch 'master' into line-rendering
manthey Dec 1, 2016
1420881
Support renderer selection in the glLines test for comparison purposes.
manthey Dec 2, 2016
e9e7f10
Older versions of firefox can use trig functions with constant argume…
manthey Dec 5, 2016
c635028
Merge branch 'master' into line-rendering
manthey Dec 19, 2016
81c54e9
Add line tests.
manthey Dec 19, 2016
6d53e61
Add an image test for webgl lines.
manthey Dec 19, 2016
62d5b48
Remove the selenium glLines test.
manthey Dec 20, 2016
8bce80d
Move the WebGL lines speed test to the headless webgl test method.
manthey Dec 22, 2016
42417cd
Change how test data is proxied through karma.
manthey Jan 2, 2017
7eb7e53
Add the ability to test examples.
manthey Dec 9, 2016
9bf511b
Fix travis build of example tests.
manthey Jan 3, 2017
04f04cf
Use a proxy with firefox to avoid loading external files in the examp…
manthey Jan 3, 2017
71c146a
Allow examples to use local files for tiles instead of external data.
manthey Jan 4, 2017
f85f792
Include imagemagick in the recommended provisioning. We use the impo…
manthey Jan 10, 2017
60b1b2b
Merge pull request #658 from OpenGeoscience/test-examples
manthey Jan 10, 2017
87801cd
Wrap some long lines.
manthey Jan 13, 2017
b8c9e26
Set the default antialiasing to 2.
manthey Jan 16, 2017
c7c2db0
Merge branch 'master' into line-rendering
manthey Jan 18, 2017
dd7b0a6
Add comments about packing values into flags.
manthey Jan 18, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ cache:
- "$HOME/cache"

before_install:
# Start xvfb with a specific resolution and pixel depth
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x24"
- CACHE="${HOME}/cache" CMAKE_VERSION=3.5.0 CMAKE_SHORT_VERSION=3.5 source ./scripts/install_cmake.sh
- npm prune

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run build
Expand Down
29 changes: 25 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ add_custom_target(
)
add_test(NAME get_data_files COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target data_files)

add_custom_command(OUTPUT "${GEOJS_DEPLOY_DIR}/examples/bundle.js"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND npm run build-examples
COMMENT "Build examples"
VERBATIM
)
add_custom_target(examples DEPENDS "${GEOJS_DEPLOY_DIR}/examples/bundle.js")
add_test(NAME build_examples COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target examples)
set_property(TEST "build_examples" APPEND PROPERTY DEPENDS "get_data_files")

if(FFHEADLESS_TESTS)
find_program(NPM_EXECUTABLE npm)
add_test(
Expand All @@ -111,6 +121,16 @@ if(FFHEADLESS_TESTS)
set_property(TEST "total-coverage" APPEND PROPERTY DEPENDS "ffheadless")
set_property(TEST "ffheadless" APPEND PROPERTY DEPENDS "get_data_files")

add_test(
NAME "examplesheadless"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND npm run examplesci
)
set_property(TEST "examplesheadless" APPEND PROPERTY ENVIRONMENT "CTEST_IMAGE_PATH=${CMAKE_CURRENT_BINARY_DIR}/images")
set_property(TEST "examplesheadless" APPEND PROPERTY ENVIRONMENT "TEST_SAVE_IMAGE=${TEST_SAVE_IMAGE}")
set_property(TEST "total-coverage" APPEND PROPERTY DEPENDS "examplesheadless")
set_property(TEST "examplesheadless" APPEND PROPERTY DEPENDS "build_examples")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/testing/test-runners/baseline_images.py"
"${CMAKE_CURRENT_BINARY_DIR}/test/baseline_images.py"
Expand All @@ -124,8 +144,12 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/base-images.tgz"
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target data_files
# Run the ffheadless test, asking to save all images
COMMAND TEST_SAVE_IMAGE=all npm run ffci
# Build examples to make sure that they are available.
COMMAND npm run build-examples
# Run the examplesheadless test, asking to save all images
COMMAND TEST_SAVE_IMAGE=all npm run examplesci
# Make a tarball of all of the images
COMMAND tar -zcvf "${CMAKE_CURRENT_BINARY_DIR}/base-images.tgz" --exclude=*-test.png --exclude=*-diff.png --exclude=*-base.png -C "${CMAKE_CURRENT_BINARY_DIR}/images" .
COMMAND tar -zcvf "${CMAKE_CURRENT_BINARY_DIR}/base-images.tgz" --exclude=*-test.png --exclude=*-diff.png --exclude=*-base.png --exclude=*-screen.png -C "${CMAKE_CURRENT_BINARY_DIR}/images" .
COMMENT "Create baseline images, then tar them into a single file"
VERBATIM
)
Expand Down Expand Up @@ -208,9 +232,6 @@ if(SELENIUM_TESTS)
set_property(TEST "selenium:glPointsSpeed" APPEND PROPERTY ENVIRONMENT "LOAD_SPEED_THRESHOLD=1000")
set_property(TEST "selenium:glPointsSpeed" APPEND PROPERTY ENVIRONMENT "FRAMERATE_THRESHOLD=5")

set_property(TEST "selenium:glLinesSpeed" APPEND PROPERTY ENVIRONMENT "LOAD_SPEED_THRESHOLD=1000")
set_property(TEST "selenium:glLinesSpeed" APPEND PROPERTY ENVIRONMENT "FRAMERATE_THRESHOLD=2")

add_custom_target(
selenium_tests
ALL
Expand Down
6 changes: 6 additions & 0 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ test command or set this parameter in CMake.
build correctly. Try running ``ccmake /path/to/geojs`` for a full
list of configuration options.

Examples should be tested by creating an entry in the ``tests/example-cases/``
directory. To run these tests in a normal browser, run
``npm run start`` and browse to `<http://localhost:9876/debug.html?test=all>`_.
Since the browser's direct screen output is used, the browser must be running
on the same machine as the ``npm run start`` command.

Selenium testing
----------------

Expand Down
1 change: 1 addition & 0 deletions docs/provisioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ convenience in configuring CMake options) ::
sudo apt-get install --yes \
cmake \
firefox \
imagemagick \
git \
libjpeg8-dev \
libpango1.0-dev \
Expand Down
3 changes: 3 additions & 0 deletions examples/hurricanes/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
body {
overflow: hidden;
}
#app-hovered-info {
position: absolute;
bottom: 10px;
Expand Down
9 changes: 9 additions & 0 deletions examples/lines/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"path": "lines",
"title": "Line Feature",
"exampleCss": ["main.css"],
"exampleJs": ["main.js"],
"about": {
"text": "This example shows the variations that are available for line features."
}
}
45 changes: 45 additions & 0 deletions examples/lines/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
extends ../common/templates/index.jade

block append mainContent
div#controls
.form-group(title="Number of lines segments. Leave blank for a small default value.")
label(for="lines") Number of Lines
input#lines(type="number" min="1" step="100")
span#lines-shown
.form-group(title="Stroke Color (any css color). A comma-separated list will cycle through the listed colors. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to colors, with undefined values using the 'other' entry.")
label(for="strokeColor") strokeColor
input#strokeColor(placeholder="black")
.form-group(title="Stroke Opacity (a number in the range [0, 1]). A comma-separated list will cycle through the listed opacities. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to opacities, with undefined values using the 'other' entry.")
label(for="strokeOpacity") strokeOpacity
input#strokeOpacity(placeholder="1")
.form-group(title="Stroke Width (a positive number). A comma-separated list will cycle through the listed widths. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to widths, with undefined values using the 'other' entry.")
label(for="strokeWidth") strokeWidth
input#strokeWidth(placeholder="2")
.form-group(title="Stroke Offset (a number in the range [-1, 1]). A comma-separated list will cycle through the listed offsets. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to offsets, with undefined values using the 'other' entry.")
label(for="strokeOffset") strokeOffset
input#strokeOffset(placeholder="0")
.form-group(title="Line Cap (one of 'butt', 'round', or 'square'). A comma-separated list will cycle through the listed line caps. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to line caps, with undefined values using the 'other' entry.")
label(for="lineCap") lineCap
input#lineCap(placeholder="butt")
.form-group(title="Line Join (one of 'miter', 'bevel', 'round', or 'miter-clip'). A comma-separated list will cycle through the listed line joins. line:(comma-separate list) will cycle through by line. A JSON dictionary will map road categories to line joins, with undefined values using the 'other' entry.")
label(for="lineJoin") lineJoin
input#lineJoin(placeholder="miter")
.form-group(title="Miter Limit (a positive number). Any miter whose length relative to the stroke with longer than this value will either be beveled or clipped.")
label(for="miterLimit") miterLimit
input#miterLimit(placeholder="10")
.form-group(title="Antialiasing (a non-negative number). Edges of lines will be antialiased by this many pixels. Values larger than 2 tend to make things blurry.")
label(for="antialiasing") antialiasing
input#antialiasing(placeholder="2")
.form-group(title="Show road names and categories on hover.")
label(for="hovertext") Info on Hover
input#hovertext(type="checkbox", placeholder="false")
.form-group(title="Show an OSM map underneath the lines.")
label(for="showmap") Show Map
input#showmap(type="checkbox", placeholder="true", checked="checked")
.form-group
.shortlabel Presets
button.preset(strokeColor='{"residential":"blue","service":"green","other":"black"}', strokeWidth='{"residential":4,"service":1,"other":8}', lineCap='round', showmap='true', title='Properties based on road category') Categories
button.preset(strokeColor='', strokeWidth='{"residential":1,"service":0.25,"other":3}', lineCap='round', lineJoin='', miterLimit='', showmap='false', title='Thin lines based on road category') Thin
button.preset(strokeColor='line:red,orange,yellow,green,blue,indigo,violet', strokeWidth='line:1,2,4,8,16', lineCap='line:butt,round,square', lineJoin='line:miter,bevel,round,miter-clip', miterLimit=4, title='Properties varied by line') Lines
button.preset(strokeColor='red,orange,yellow,green,blue,indigo,violet', strokeWidth='1,2,4,8,16', lineCap='butt,round,square', lineJoin='miter,bevel,round,miter-clip', miterLimit=4, title='Properties varied by line segment') Segments

60 changes: 60 additions & 0 deletions examples/lines/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#controls {
overflow-x: hidden;
overflow-y: auto;
position: absolute;
left: 10px;
top: 80px;
z-index: 2;
border-radius: 5px;
border: 1px solid grey;
box-shadow: 1px 1px 3px black;
opacity: 0.5;
transition: opacity 250ms ease;
background: #CCC;
color: black;
padding: 4px;
font-size: 14px;
max-height: calc(100% - 100px);
min-width: 310px;
}
#controls:hover {
opacity: 1;
}
#controls .form-group {
margin-bottom: 0;
}
#controls label {
min-width: 120px;
}
#controls #lines {
width: 100px;
}
#controls #lines-loaded,#controls #lines-shown {
display: inline-block;
font-size: 11px;
padding-left: 5px;
}
#controls table input {
width: 55px;
}
#controls table th {
text-align: center;
}
.shortlabel {
margin-bottom: 5px;
font-weight: bold;
display: inline-block;
}
#tooltip {
margin-left: 0px;
margin-top: -20px;
height: 20px;
line-height: 16px;
padding: 2px 5px;
background: rgba(255, 255, 255, 0.75);
border-radius: 10px;
border-bottom-left-radius: 0;
border: 1px solid rgba(0, 0, 0, 0.75);
font-size: 12px;
color: black;
}
Loading