import { OpenPlans } from 'openplans';
async function createLabeledPlan() {
const container = document.getElementById('app');
const openPlans = new OpenPlans(container);
await openPlans.setupOpenGeometry();
// Create rooms
const bedroom = openPlans.rectangle({
center: [2, 0, 2],
width: 4,
breadth: 3.5,
color: 0x000000
});
const livingRoom = openPlans.rectangle({
center: [7, 0, 2.5],
width: 6,
breadth: 5,
color: 0x000000
});
// Add room labels
const bedroomLabel = openPlans.glyph(
'Bedroom',
7,
0x5D0E41,
false
);
bedroomLabel.position.set(2, 0, 2);
const livingRoomLabel = openPlans.glyph(
'Living Room',
8,
0xFF204E,
false
);
livingRoomLabel.position.set(7, 0, 2.5);
// Add title
const title = openPlans.glyph(
'Apartment Floor Plan',
12,
0x000000,
true
);
title.position.set(5, 0, -2);
// Add scale indicator
const scale = openPlans.glyph(
'Scale 1:50',
6,
0x666666,
true
);
scale.position.set(5, 0, 7);
// List all glyphs
const allGlyphs = openPlans.glyphNodes;
console.log('Created glyphs:');
allGlyphs.forEach(node => {
console.log(`- ${node.text} at ${node.uuid}`);
});
}
createLabeledPlan();