Commit 40f860f0 authored by JOE XMG's avatar JOE XMG
Browse files

update

parent 4796eb08
Pipeline #9142 passed with stage
in 18 seconds
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml
# Full project: https://gitlab.com/pages/plain-html
pages:
stage: deploy
environment: production
script:
- mkdir .public
- cp -r ./* .public
- rm -rf public
- mv .public public
artifacts:
paths:
- public
only:
- main
{
"type": "Feature",
"name": "Bau 5",
"crs": {
"type": "name",
"properties": { "name": "EPSG:4326" }
},
"properties": {
"gmlid": ["DEBW_522100047yC"]
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[9.171446, 48.780557, 244.0],
[9.171351, 48.780686, 244.0],
[9.172466, 48.781043, 244.0],
[9.172551, 48.780914, 244.0],
[9.171446, 48.780557, 244.0]
]
]
}
}
# Tsymbal
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.rz.hft-stuttgart.de/mtws202324/tsymbal.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.rz.hft-stuttgart.de/mtws202324/tsymbal/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="https://cesium.com/downloads/cesiumjs/releases/1.87/Build/Cesium/Cesium.js"></script>
<script
type="text/javascript"
src="//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.3/proj4-src.js"
></script>
<link
href="https://cesium.com/downloads/cesiumjs/releases/1.80/Build/Cesium/Widgets/widgets.css"
rel="stylesheet"
/>
<style>
#cesiumContainer {
width: 100%;
height: 100vh;
margin: 0;
overflow: hidden;
float: right;
}
#uploadButton {
position: absolute;
top: 20px;
left: 40px;
z-index: 1;
padding: 10px;
background-color: #fff;
color: #000;
cursor: pointer;
border: 1px solid #000;
border-radius: 5px;
font-family: "Arial", sans-serif;
}
#uploadWindow {
display: none;
position: fixed;
top: 60px;
left: 40px;
padding: 60px;
background-color: #fff;
border: 1px solid #000;
border-radius: 5px;
font-family: "Arial", sans-serif;
z-index: 2;
}
#fileInput {
display: none;
}
#fileInfo {
margin-top: 20px;
}
#dragDropText {
margin-bottom: 10px;
}
#visualizeButton {
display: none;
margin-top: 10px;
padding: 8px;
background-color: #3498db;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="cesiumContainer">
<div id="uploadButton" onclick="toggleUploadWindow()">
Upload the 3D model
</div>
</div>
<div
id="uploadWindow"
ondrop="handleDrop(event)"
ondragover="handleDragOver(event)"
>
<p id="dragDropText">Drag and drop the 3D model</p>
<input
type="file"
id="fileInput"
accept=".gltf, .bin"
style="display: none"
onchange="uploadModel()"
/>
<div id="fileInfo"></div>
<button id="visualizeButton" onclick="placeModel()">
Visualize gltf in Cesium
</button>
</div>
<script>
var polygonEntity;
Cesium.Ion.defaultAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwMjA3ZDcwYy0xY2RjLTQ3NDYtYjljMy01NzQ2M2UxMzJlMzAiLCJpZCI6MTQzNTQxLCJpYXQiOjE2ODU2MjI5NzV9.C0aOUpP5AQjFa_NxMvBGmeKmKwq6mDNtPXGAsujlVmE";
var viewer = new Cesium.Viewer("cesiumContainer", {
terrainProvider: Cesium.createWorldTerrain(),
baseLayerPicker: true,
vrButton: true,
geocoder: false,
navigationHelpButton: false,
selectionIndicator: false,
shadows: true,
timeline: false,
sceneModePicker: true,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
});
viewer.extend(Cesium.viewerDragDropMixin);
viewer.dropError.addEventListener(function (viewerArg, source, error) {
window.alert("Error processing " + source + ":" + error);
});
viewer.flyToOnDrop = false;
viewer.canvas.addEventListener("drop", function (event) {
event.preventDefault();
var file = event.dataTransfer.files[0];
var reader = new FileReader();
reader.onload = function (event) {
var contents = event.target.result;
var data = JSON.parse(contents);
visualizeJson(data);
};
reader.onerror = function (event) {
console.error(
"File could not be read! Code " + event.target.error.code
);
};
reader.readAsText(file);
});
var tileset = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: "https://web3d.basemap.de/cesium/buildings-fly/root.json",
})
);
var heightOffset = 50.0;
viewer.scene.globe.depthTestAgainstTerrain = true;
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(9.17, 48.78, 500.0),
orientation: {
heading: Cesium.Math.toRadians(50.0),
pitch: Cesium.Math.toRadians(-40.0),
roll: 0.0,
},
});
tileset.readyPromise.then(function (tileset) {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(
boundingSphere,
new Cesium.HeadingPitchRange(0, -2, 0)
);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
var cartographic = Cesium.Cartographic.fromCartesian(
boundingSphere.center
);
var surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
0.0
);
var offset = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
heightOffset
);
var translation = Cesium.Cartesian3.subtract(
offset,
surface,
new Cesium.Cartesian3()
);
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
});
// Drag and drop the glTF file
function toggleUploadWindow() {
var uploadWindow = document.getElementById("uploadWindow");
uploadWindow.style.display =
uploadWindow.style.display === "none" ? "block" : "none";
// Show the drag and drop text and hide the visualize button when the window is opened
document.getElementById("dragDropText").style.display = "block";
document.getElementById("visualizeButton").style.display = "none";
}
var url;
// This function is called when the file is uploaded or dropped into the upload window
function uploadModel() {
var fileInput = document.getElementById("fileInput");
var file = fileInput.files[0];
var reader = new FileReader();
reader.onload = function (e) {
var content = e.target.result;
var blob = new Blob([content], {
type: "application/octet-stream",
});
url = URL.createObjectURL(blob);
document.getElementById("fileInfo").textContent =
"File uploaded: " + file.name;
document.getElementById("visualizeButton").style.display = "block";
};
reader.readAsArrayBuffer(file); // glTF files are binary, so use readAsArrayBuffer instead of readAsText
}
// These functions handle the drag and drop events
function handleDrop(e) {
e.preventDefault();
document.getElementById("fileInput").files = e.dataTransfer.files;
uploadModel();
}
function handleDragOver(e) {
e.preventDefault();
}
//This function is called to visualize the json
var coordinates;
var conditions = [[true, true]];
function visualizeJson(file) {
var jsonContent = file;
coordinates = jsonContent.geometry.coordinates[0];
console.log(coordinates);
var gmlId = jsonContent.properties.gmlid;
for (let i = 0; i < gmlId.length; i++) {
hideBuilding(gmlId[i]);
}
polygonEntity = viewer.entities.add({
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(
jsonContent.crs.properties.name == "EPSG:25832"
? reproject(coordinates)
: coordinates.flat()
),
material: Cesium.Color.RED.withAlpha(0.5),
},
});
viewer.zoomTo(polygonEntity);
console.log(coordinates[1]);
console.log(coordinates[1][0]);
console.log(coordinates[1][1]);
}
function updateHideCondition(gmlId) {
conditions.unshift(['${gml_id} === "' + gmlId + '"', false]);
}
function hideBuilding(gmlId) {
updateHideCondition(gmlId);
tileset.style = new Cesium.Cesium3DTileStyle({
show: {
conditions: conditions,
},
});
}
//reproject coordinate system to WGS if needed
function reproject(coordinates) {
proj4.defs["EPSG:25832"] =
"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";
var sourceProj = proj4.defs["EPSG:25832"];
var destProj = "EPSG:4326"; // WGS84, used by Cesium
return coordinates
.map(function (coord) {
return proj4(sourceProj, destProj, coord);
})
.flat();
}
function placeModel() {
//orientation calculation
var vertex1 = coordinates[0];
console.log(vertex1);
var vertex2 = coordinates[1];
console.log(vertex2);
// Convert the coordinates to radians
var lat1 = Cesium.Math.toRadians(vertex1[1]);
var lon1 = Cesium.Math.toRadians(vertex1[0]);
var lat2 = Cesium.Math.toRadians(vertex2[1]);
var lon2 = Cesium.Math.toRadians(vertex2[0]);
// Calculate the difference in longitude
var dLon = lon2 - lon1;
// Calculate the heading
var y = Math.sin(dLon) * Math.cos(lat2);
var x =
Math.cos(lat1) * Math.sin(lat2) -
Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
var heading = Math.atan2(y, x);
// Convert the heading to degrees and adjust the range to 0-360
heading = Cesium.Math.toDegrees(heading);
if (heading < 0) heading += 180;
heading = Cesium.Math.toRadians(heading + 90) % (2 * Math.PI);
// center point calculation as an intersection of the rectangle's diagonales
// Calculate midpoints of opposite sides
var midPoint1 = [
(coordinates[0][0] + coordinates[2][0]) / 2,
(coordinates[0][1] + coordinates[2][1]) / 2,
];
var midPoint2 = [
(coordinates[1][0] + coordinates[3][0]) / 2,
(coordinates[1][1] + coordinates[3][1]) / 2,
];
// Calculate the intersection point of diagonals
var cenlat = (midPoint1[0] + midPoint2[0]) / 2;
var cenlon = (midPoint1[1] + midPoint2[1]) / 2;
var zcoord = coordinates[0][2] + heightOffset;
var center = Cesium.Cartesian3.fromDegrees(cenlat, cenlon, zcoord);
// Create a rotation matrix from this heading
var pitch = 0;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(
center,
hpr
);
// Add the model to the viewer
var model = viewer.entities.add({
name: "Bau5",
position: center,
orientation: orientation,
model: {
uri: url,
show: true,
scale: 1.0,
},
});
}
</script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment