Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ exclude_patterns:
- "public/js/PLYLoader.js"
- "public/js/STLLoader.js"
- "public/js/three.min.js"
- "public/js/OBJLoader.js"
- "public/js/OBJLoader2.js"
- "public/js/LoaderSupport.js"
- "public/js/OutlinePass.js"
- "public/js/MTLLoader.js"
- "public/js/EffectComposer.js"
- "db"
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
addons:
postgresql: 9.6

language: ruby
os: linux

Expand All @@ -11,9 +14,9 @@ before_install:
env:
- DB=postgresql

before_script:
- rails db:create
- rails db:migrate
script:
- rails db:drop db:create db:migrate RAILS_ENV=test
- rails test

rvm:
- 2.3.3
- 2.5.0
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/codahale/bcrypt-ruby.git
revision: 011b67ba550457dab5d6084128888f08476f278a
revision: 2875dbf4359ef9ce88775f4aae67aaa011f930fa
specs:
bcrypt (3.1.13)

Expand Down Expand Up @@ -98,16 +98,16 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.4)
devise (4.6.2)
crass (1.0.5)
devise (4.7.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.8.0)
devise (>= 4.6)
erubi (1.8.0)
devise-i18n (1.9.0)
devise (>= 4.7.1)
erubi (1.9.0)
execjs (2.7.0)
ffi (1.11.1)
ffi (1.11.1-x86-mingw32)
Expand All @@ -119,7 +119,7 @@ GEM
multi_json
request_store (>= 1.0)
high_voltage (3.1.2)
i18n (1.6.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
Expand All @@ -140,7 +140,7 @@ GEM
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
loofah (2.2.3)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -151,12 +151,12 @@ GEM
mimemagic (0.3.3)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.13.0)
multi_json (1.13.1)
nio4r (2.4.0)
nokogiri (1.10.3)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.3-x86-mingw32)
nokogiri (1.10.7-x86-mingw32)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pg (1.1.4)
Expand Down Expand Up @@ -187,8 +187,8 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
Expand Down
146 changes: 145 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,150 @@
# FragmentX

## 3D Visualization of restored objects

[![Build Status](https://travis-ci.org/FragmentX/FRAGMENTX.svg?branch=master)](https://travis-ci.org/FragmentX/FRAGMENTX) [![Maintainability](https://api.codeclimate.com/v1/badges/900fd8a114c8d71e0142/maintainability)](https://codeclimate.com/github/FragmentX/FRAGMENTX/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/900fd8a114c8d71e0142/test_coverage)](https://codeclimate.com/github/FragmentX/FRAGMENTX/test_coverage) [![security](https://hakiri.io/github/FragmentX/FRAGMENTX/master.svg)](https://hakiri.io/github/FragmentX/FRAGMENTX/master)

http://scanviewer.herokuapp.com/


[//]: # (badges)
[![security](https://img.shields.io/badge/contributors-4-blue)](https://img.shields.io/badge/contributors-4-blue)

[//]: # (badges)

> [FragmentX web](http://scanviewer.herokuapp.com/)
>
> [http://scanviewer.herokuapp.com/](http://scanviewer.herokuapp.com/)
>

## Description
FragmentX is an open source 3D objects viewer build using Ruby on Rails and Three JS. Is part of an European project in the UPV and the final degree project of one of the creators.

FragmentX tries to bring to museums in particular and people in general a tool to store and visualize masterpieces and any type of 3D objects. Often this kind of objects are fragmented or divided in several pieces. Our 3D viewer is able to show all the fragments of these objects.

The platform created is on the web because we wanted to create a more accessible tool for everybody. It could be used in any device.

## Version
The application is under development. This means that there is not a release or a beta version yet. The FragmentX team and its community is working on its first beta release.

### 0.2 Alpha 20181127
#### Features
* [X] OBJ file format loader
* [X] Orthographic and Perspective cameras switch
* [X] Added continuous Integration
* [X] Added code quality checker
* [X] Added vulnerability checker
* [X] Added dependaBot
#### Bugs
* [X] Orthographic fails when is switched a few times


#### Changes
* [X] Redesigned interface
* [X] Refactored Code


### 0.1 Alpha 20180713

#### Features
* [X] STL file format loader
* [X] ZIP automatic restored object loader
* [X] 3D Restored Object viewer
* [X] Clipping X, Y, Z planes
* [X] Canvas Screenshoot
* [X] Pieces measurement
* [X] Show nearby pieces
* [X] Basic design and lading page
* [X] Async pieces loader using ThreeJS web workers
* [X] Automatic deploy on Heroku
* [X] Translations (English and Spanish)


## Installation

### Dependecies
* Ruby version: [2.6](https://www.ruby-lang.org/es/news/2019/03/13/ruby-2-6-2-released/)
* Rails version: [5.2.3](https://weblog.rubyonrails.org/2019/3/28/Rails-5-2-3-has-been-released/)
* PostgreSQL version: [9.5](https://www.postgresql.org/docs/9.5/index.html)
* NodeJS version: [10.16.3](https://nodejs.org/uk/blog/release/v0.10.16/)
* gcc and g++ version: [5.4](https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/)

### Recomended
* Ubuntu 16.04~18.04, Kubuntu, or Debian based OS
* Git
### Installation steps

* Update the Ubuntu repositories
```shell
sudo apt-get update
```
* Install basic dependencies for Ruby on Rails (Git is optional)
```shell
sudo apt-get install git
sudo apt install curl
sudo apt install -y nodejs
sudo apt install gcc g++ make
```
* Clone the repo from our master branch
```shell
git clone https://github.com/FragmentX/FRAGMENTX.git
cd FRAGMENTX/
```
* Ruby installation and basic setup of the rvm
```shell
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable --ruby
source /home/duxy1996/.rvm/scripts/rvm
rvm install ruby-2.6.1
rvm --default use ruby-2.6.1
```
* Rails 5.2.0 installation
```shell
gem update --system
gem install rails -v 5.2.0
```
* PostgreSQL database installation and postgresql gem installation
```shell
sudo apt install postgresql postgresql-contrib libpq-dev -y
systemctl start postgresql
systemctl enable postgresql
```
* Ruby basic gem installation
```shell
sudo apt-get install ruby-railties
sudo apt install ruby-bundler
bundle install
```
* Database creation and migration. Applies all the changes made in the migrations folder. It is empty, to feed the database should run ` rails db:seed`. With the `rails s` command the appplication is launched in localhost:3000
```shell
rails db:create
rails db:migrate
rails s
```
#### Optional
PostgreSQL sometimes is not well set up. You have to modify the file **pg_hba.conf** to allow to enter to the database and create the profile/user for manage the application databases.
```shell
sudo gedit /etc/postgresql/9.5/main/pg_hba.conf
```

## Contributors


[Álvaro Casado Coscollá.](https://github.com/alvarocasadoc) Architect and developer

[ Carlos Durán Roca.](https://github.com/Duxy1996) Architect and developer

[Dependa Baller bot.](https://github.com/marketplace/dependabot-preview)

[//]: # (contributors)




## References


* [Ruby tests for models and controllers](https://guides.rubyonrails.org/testing.html)
* [PostgreSQL test database initialization error](https://stackoverflow.com/questions/19097558/pg-undefinedtable-error-relation-users-does-not-exist)
* [PostgreSQL test fixture error](https://stackoverflow.com/questions/58190137/database-error-on-executing-test-ruby-on-rails-with-postgres)
* [PostgreSQL Travis configuration](https://medium.com/hexient-labs/configuring-travis-ci-for-a-rails-project-d25bc2f2ba7e)

11 changes: 0 additions & 11 deletions app/controllers/restored_objects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,13 @@ def create
authorize @object
if params[:zip_file]
params[:pieces_attributes] = nil
puts "About to read the file"
Zip::File.open(params[:zip_file].path) do |zipfile|
puts "Reading zip file"
zipfile.glob('*{ply,stl,obj}') do |file|
puts "Reading #{file.name}"
# tempfile = Tempfile.new(File.basename(file.name))
# tempfile.binmode
# tempfile.write file.get_input_stream.read

puts "Reading matrix"
matrix = zipfile.glob("#{file.name.split('.').first}.txt").first.get_input_stream.read
puts matrix

piece = @object.pieces.create(name: file.name, matrix: matrix)
end
end
end

respond_to do |format|
if @object.save
format.html { redirect_to @object }
Expand Down
2 changes: 0 additions & 2 deletions app/models/object_format.rb

This file was deleted.

10 changes: 6 additions & 4 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
</div>
</section>

<% if @featured_museum != nil %>
<%= link_to @featured_museum, class: "no-decoration" do %>
<section id="featured" >
<div class="container">
<h2 class="fancy-title"><%= t('home.featured_museum') %></h2>
<p><%= t('home.featured_museum_info') %></p>
<br/>
<div class="user-header">
<h2 style="display: inline">
<%= image_tag @featured_museum.avatar_image, class: 'avatar' %>
<%= @featured_museum.name %>
<h2 style="display: inline">
<%= image_tag @featured_museum.avatar_image, class: 'avatar' %>
<%= @featured_museum.name %>
</h2>
</div>
<br/>
Expand Down Expand Up @@ -59,6 +60,7 @@
</div>
</div>
</section>
<% end %>

<section id="features">
<div class="container row" style="margin: 0 auto">
Expand Down Expand Up @@ -132,4 +134,4 @@ function render() {
document.addEventListener("turbolinks:load", function() {
render();
});
</script>
</script>
2 changes: 1 addition & 1 deletion app/views/restored_objects/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<div class="container">
<div class="card-columns">
<% @objects.sort[3..-1].each_with_index do |obj, index| %>
<% @objects.each_with_index do |obj, index| %>
<div class="card">
<%= link_to image_tag(obj.featured_image, class:'card-img-top'), obj %>
<div class="card-body">
Expand Down
Loading