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

Feature/my map #50

Merged
merged 8 commits into from
Dec 20, 2024
Merged
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
1 change: 1 addition & 0 deletions symfony/fixtures/actors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ App\Entity\Actor:
administrativeScopes: '<numberBetween(1, 3)>x @administrative_scope_*'
officeName: <companySuffix()>
officeAddress: <address()>
geoData: '@geoData_<current()>'
officeLocation: '<numberBetween(2, 13)>.<numberBetween(100000, 999999)>, <numberBetween(8, 16)>.<numberBetween(100000, 999999)>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A remplacer par geoData, et à adapter dans le formulaire de création/édition

contactName: <name()>
contactPosition: <jobTitle()>
Expand Down
3 changes: 2 additions & 1 deletion symfony/fixtures/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ App\Entity\Resource:
endAt: '<dateTimeBetween($startAt, $startAt)>'
thematics: '<numberBetween(1, 3)>x @thematic_*'
link: https://<domainName()>
geoData: '@geoData_<current()>'
createdBy: '@user_*'
isValidated: <boolean(70)>
author: <firstName()> <lastName()>
author: <firstName()> <lastName()>
36 changes: 36 additions & 0 deletions symfony/migrations/Version20241213222822.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241213222822 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE actor ADD geo_data_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F980E32C3E FOREIGN KEY (geo_data_id) REFERENCES geo_data (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX UNIQ_447556F980E32C3E ON actor (geo_data_id)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F980E32C3E');
$this->addSql('DROP INDEX UNIQ_447556F980E32C3E');
$this->addSql('ALTER TABLE actor DROP geo_data_id');
}
}
32 changes: 32 additions & 0 deletions symfony/migrations/Version20241213223524.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241213223524 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE geo_data ALTER osm_id TYPE INT');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE geo_data ALTER osm_id TYPE BIGINT');
}
}
32 changes: 32 additions & 0 deletions symfony/migrations/Version20241213223750.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241213223750 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE geo_data ALTER osm_id TYPE BIGINT');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE geo_data ALTER osm_id TYPE INT');
}
}
4 changes: 3 additions & 1 deletion symfony/src/Entity/Actor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Entity\Trait\BlameableEntity;
use App\Entity\Trait\LocalizableEntity;
use App\Entity\Trait\SluggableEntity;
use App\Entity\Trait\TimestampableEntity;
use App\Entity\Trait\ValidateableEntity;
Expand Down Expand Up @@ -67,12 +68,13 @@ class Actor
{
use TimestampableEntity;
use SluggableEntity;
use LocalizableEntity;
use BlameableEntity;
use ValidateableEntity;
public const ACTOR_READ_COLLECTION = 'actor:read_collection';
public const ACTOR_READ_COLLECTION_ALL = 'actor:read_collection:all';
public const ACTOR_READ_ITEM = 'actor:read_item';
private const ACTOR_WRITE = 'actor:write';
public const ACTOR_WRITE = 'actor:write';

#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
Expand Down
8 changes: 4 additions & 4 deletions symfony/src/Entity/GeoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class GeoData
private ?int $id = null;

#[ORM\Column(type: 'bigint')]
#[Groups([Project::GET_FULL, Resource::GET_FULL])]
#[Groups([Project::GET_FULL, Resource::GET_FULL, Actor::ACTOR_READ_ITEM])]
private ?int $osmId = null;

#[ORM\Column]
#[Groups([Project::GET_FULL, Resource::GET_FULL])]
#[Groups([Project::GET_FULL, Resource::GET_FULL, Actor::ACTOR_READ_ITEM])]
private ?string $osmType = 'node';

#[ORM\Column(length: 255)]
#[Groups([PROJECT::GET_FULL, PROJECT::GET_PARTIAL, Actor::ACTOR_READ_ITEM, Resource::GET_FULL, Resource::WRITE])]
#[Groups([PROJECT::GET_FULL, PROJECT::GET_PARTIAL, Resource::GET_FULL, Resource::WRITE, Actor::ACTOR_READ_COLLECTION])]
private ?string $name = null;

#[ORM\Column(nullable: true)]
Expand Down Expand Up @@ -115,7 +115,7 @@ public function setAddress(?array $address): static
return $this;
}

#[Groups([Project::GET_PARTIAL])]
#[Groups([Project::GET_PARTIAL, Resource::GET_FULL, Actor::ACTOR_READ_COLLECTION])]
public function getCoords(): ?array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/Thematic.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Thematic
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups([self::THEMATIC_READ, Resource::GET_FULL, Project::GET_FULL, Project::GET_PARTIAL])]
#[Groups([self::THEMATIC_READ, Resource::GET_FULL, Actor::ACTOR_READ_COLLECTION, Project::GET_FULL, Project::GET_PARTIAL])]
private ?int $id = null;

#[ORM\Column(length: 255)]
Expand Down
4 changes: 2 additions & 2 deletions symfony/src/Entity/Trait/LocalizableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

trait LocalizableEntity
{
#[Groups([Project::WRITE, Resource::WRITE])]
#[Groups([Project::WRITE, Resource::WRITE, Actor::ACTOR_WRITE])]
private ?array $osmData = null;

#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[Groups([Project::GET_FULL, Project::GET_PARTIAL, Actor::ACTOR_READ_ITEM, Resource::GET_FULL])]
#[Groups([Project::GET_FULL, Project::GET_PARTIAL, Actor::ACTOR_READ_ITEM, Actor::ACTOR_READ_COLLECTION, Resource::GET_FULL])]
private ?GeoData $geoData = null;

public function getOsmData(): ?array
Expand Down
1 change: 1 addition & 0 deletions vue/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_MAPTILER_API_KEY=0tupl15DKhXOvwp27x8c
Binary file added vue/public/img/map/actor_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vue/public/img/map/project_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vue/public/img/map/project_icon_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vue/public/img/map/resource_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<template>
<div class="App" :is-100-vh="appStore.is100vh" :is-light-header="appStore.isLightHeader">
<Header />
<KeepAlive>
<DialogController />
</KeepAlive>
<EditContentDialog />
<NotificationBox />
<Header v-if="!appStore.isFullViewport" />
<div
:class="
'App__content container ' +
'App__content ' +
(!appStore.isFullViewport ? 'container ' : '') +
(appStore.mobile ? 'App__content--mobile' : 'App__content--desktop')
"
>
<v-breadcrumbs
v-if="!appStore.mobile"
v-if="!appStore.mobile && !appStore.isFullViewport"
class="Breadcrumbs"
:items="appStore.breadcrumbs"
></v-breadcrumbs>
<RouterView />
</div>
<Footer />
<Footer v-if="!appStore.isFullViewport" />
<KeepAlive>
<DialogController />
</KeepAlive>
<EditContentDialog />
<NotificationBox />
</div>
</template>

Expand Down
Binary file added vue/src/assets/images/icons/map/actor_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vue/src/assets/images/icons/map/resource_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vue/src/assets/images/map/basemap/satellite.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vue/src/assets/styles/global/vars/_dimensions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $header-mobile-height: 64px;
$dim-container-w: 70rem;

$dim-dialog-w: 31.25rem;
$dim-radius: 5px;
$dim-radius: 3px;

// Breakpoints
$bp-sm: 576px;
Expand Down
10 changes: 10 additions & 0 deletions vue/src/assets/styles/global/vuetifyOverrides.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
:root {
--v-shadow-key-umbra-opacity: rgba(0, 0, 0, 0.1);
--v-shadow-key-penumbra-opacity: rgba(0, 0, 0, 0.075);
--v-shadow-key-ambient-opacity: rgba(0, 0, 0, 0.05);
}

.elevation-1 {
box-shadow: 0 0.125rem 0.25rem -0.125rem rgba(0, 0, 0, 0.15) !important;
}

// To be replaced by customized variables: https://vuetifyjs.com/en/features/sass-variables/#component-specific-variables
.v-field--variant-solo, .v-field--variant-solo-filled {
box-shadow: none !important;
Expand Down
1 change: 1 addition & 0 deletions vue/src/assets/translations/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"cancel": "Annuler",
"create": "Créer",
"delete": "Supprimer",
"or": "OU",
"errorMessages": {
"required": "Ce champs est requis",
"minlength": "Ce champs doit avoir au moins {min} caractères",
Expand Down
37 changes: 37 additions & 0 deletions vue/src/assets/translations/fr/myMap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"myMap": {
"header": {
"share": "Partager",
"search": {
"placeholder": "Rechercher un lieu ou une donnée"
}
},
"components": {
"opacity": "Transparence"
},
"leftSidebar": {
"welcome": {
"title": "Bienvenue",
"description": "Composez votre carte grâce aux données mises à disposition sur la Plateforme Urbaine du Cameroun.",
"moreAccess": "Vous souhaitez avoir accès à plus de données et d’outils ?",
"close": "Fermer"
}

},
"rightSidebar": {
"actions": {
"about": "À propos",
"share": "Partager",
"downloadLayer": "Télécharger la couche",
"opacity": "Ajuster la transparence"
},
"layers": {
"itemType": {
"project": "Projets",
"actor": "Acteurs",
"resource": "Ressources"
}
}
}
}
}
1 change: 0 additions & 1 deletion vue/src/assets/translations/fr/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"edit": "Modifier une ressource",
"validate": "Valider une ressource"
},
"or": "OU",
"fields": {
"name": {
"label": "Nom de la ressource",
Expand Down
28 changes: 25 additions & 3 deletions vue/src/components/forms/Geocoding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
density="compact"
featureType="city"
variant="outlined"
:placeholder="$t('geocoding.placeholder')"
:placeholder="placeholder"
:no-data-text="$t('geocoding.noData')"
:items="geocodingItems"
:clearable="true"
:item-value="(val) => val"
:item-title="(val) => val.osmName"
v-model="osmData"
@update:search="(e) => (searchQuery = e)"
@click:clear="(e) => (searchQuery = '')"
>
<template v-slot:prepend-inner>
<v-icon icon="mdi-map-marker-outline" color="main-blue" class="opacity-80"></v-icon>
<v-icon :icon="icon" color="main-blue" class="opacity-100"></v-icon>
</template>
<template v-slot:append-inner>
<v-fade-transition>
Expand All @@ -37,13 +38,34 @@ import GeocodingService from '@/services/map/GeocodingService'
import { debounce } from '@/services/utils/UtilsService'
import { NominatimSearchType } from '@/models/enums/geo/NominatimSearchType'
import type { GeocodingItem } from '@/models/interfaces/geo/GeocodingItem'
import type { OsmData } from '@/models/interfaces/geo/OsmData'
import { i18n } from '@/plugins/i18n'

const osmData = defineModel<OsmData | null>({
default: null
})

const props = withDefaults(
defineProps<{
searchType: NominatimSearchType
icon?: string
geometryDetails?: boolean
placeholder?: string
}>(),
{
searchType: NominatimSearchType.FREE
searchType: NominatimSearchType.FREE,
icon: 'mdi-map-marker-outline',
geometryDetails: false,
placeholder: i18n.t('geocoding.placeholder')
}
)

watch(
() => osmData.value,
async () => {
if (osmData.value && props.geometryDetails) {
osmData.value = await GeocodingService.getBbox(osmData.value)
}
}
)

Expand Down
Loading
Loading