You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.1 KiB
84 lines
2.1 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>MTree API Interface</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
}
|
|
|
|
h1 {
|
|
color: #333;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
input[type="text"] {
|
|
padding: 8px;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
button {
|
|
padding: 10px 15px;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>MTree API Interface</h1>
|
|
<div class="form-group">
|
|
<label for="queryPoint">Query Point (JSON Array):</label>
|
|
<input type="text" id="queryPoint" placeholder='e.g. [0.5, 0.5]' />
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="radius">Radius:</label>
|
|
<input type="text" id="radius" placeholder="e.g. 1.0" />
|
|
</div>
|
|
<button onclick="performRangeQuery()">Perform Range Query</button>
|
|
|
|
<div class="form-group">
|
|
<label for="knn">Number of Neighbors (k):</label>
|
|
<input type="text" id="knn" placeholder="e.g. 5" />
|
|
</div>
|
|
<button onclick="performKNNQuery()">Perform KNN Query</button>
|
|
|
|
<div id="result"></div>
|
|
|
|
<script>
|
|
async function performRangeQuery() {
|
|
const queryPoint = document.getElementById('queryPoint').value;
|
|
const radius = document.getElementById('radius').value;
|
|
const response = await fetch(`/rangeQuery?queryPoint=${encodeURIComponent(queryPoint)}&radius=${encodeURIComponent(radius)}`);
|
|
document.getElementById('result').innerText = await response.text();
|
|
}
|
|
|
|
async function performKNNQuery() {
|
|
const queryPoint = document.getElementById('queryPoint').value;
|
|
const k = document.getElementById('knn').value;
|
|
const response = await fetch(`/kNNQuery?queryPoint=${encodeURIComponent(queryPoint)}&k=${encodeURIComponent(k)}`);
|
|
document.getElementById('result').innerText = await response.text();
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|